共用方式為


View.OnKeyPreIme(Keycode, KeyEvent) Method

Definition

Handle a key event before it is processed by any input method associated with the view hierarchy.

[Android.Runtime.Register("onKeyPreIme", "(ILandroid/view/KeyEvent;)Z", "GetOnKeyPreIme_ILandroid_view_KeyEvent_Handler")]
public virtual bool OnKeyPreIme (Android.Views.Keycode keyCode, Android.Views.KeyEvent? e);
[<Android.Runtime.Register("onKeyPreIme", "(ILandroid/view/KeyEvent;)Z", "GetOnKeyPreIme_ILandroid_view_KeyEvent_Handler")>]
abstract member OnKeyPreIme : Android.Views.Keycode * Android.Views.KeyEvent -> bool
override this.OnKeyPreIme : Android.Views.Keycode * Android.Views.KeyEvent -> bool

Parameters

keyCode
Keycode

The value in event.getKeyCode().

e
KeyEvent

Description of the key event.

Returns

If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

Attributes

Remarks

Handle a key event before it is processed by any input method associated with the view hierarchy. This can be used to intercept key events in special situations before the IME consumes them; a typical example would be handling the BACK key to update the application's UI instead of allowing the IME to see it and close itself.

Java documentation for android.view.View.onKeyPreIme(int, 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