Since: API Level 1
public static interface

View.OnKeyListener

android.view.View.OnKeyListener

类概述

Interface definition for a callback to be invoked when a key event is dispatched to this view. The callback will be invoked before the key event is given to the view.

摘要

公有方法
abstract boolean onKey( View v, int keyCode, KeyEvent event)
Called when a key is dispatched to a view.

公有方法

public abstract boolean onKey (View v, int keyCode, KeyEvent event)

Since: API Level 1

Called when a key is dispatched to a view. This allows listeners to get a chance to respond before the target view.

Parameters
v The view the key has been dispatched to.
keyCode The code for the physical key that was pressed
event The KeyEvent object containing full information about the event.
Returns
  • True if the listener has consumed the event, false otherwise.