共用方式為


Activity.DispatchKeyEvent(KeyEvent) Method

Definition

Called to process key events.

[Android.Runtime.Register("dispatchKeyEvent", "(Landroid/view/KeyEvent;)Z", "GetDispatchKeyEvent_Landroid_view_KeyEvent_Handler")]
public virtual bool DispatchKeyEvent (Android.Views.KeyEvent? e);
[<Android.Runtime.Register("dispatchKeyEvent", "(Landroid/view/KeyEvent;)Z", "GetDispatchKeyEvent_Landroid_view_KeyEvent_Handler")>]
abstract member DispatchKeyEvent : Android.Views.KeyEvent -> bool
override this.DispatchKeyEvent : Android.Views.KeyEvent -> bool

Parameters

e
KeyEvent

The key event.

Returns

boolean Return true if this event was consumed.

Implements

Attributes

Remarks

Called to process key events. You can override this to intercept all key events before they are dispatched to the window. Be sure to call this implementation for key events that should be handled normally.

Java documentation for android.app.Activity.dispatchKeyEvent(android.view.KeyEvent).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to