共用方式為


Activity.SetDefaultKeyMode(DefaultKey) Method

Definition

Select the default key handling for this activity.

[Android.Runtime.Register("setDefaultKeyMode", "(I)V", "")]
public void SetDefaultKeyMode (Android.App.DefaultKey mode);
[<Android.Runtime.Register("setDefaultKeyMode", "(I)V", "")>]
member this.SetDefaultKeyMode : Android.App.DefaultKey -> unit

Parameters

mode
DefaultKey

The desired default key mode constant.

Attributes

Remarks

Select the default key handling for this activity. This controls what will happen to key events that are not otherwise handled. The default mode (#DEFAULT_KEYS_DISABLE) will simply drop them on the floor. Other modes allow you to launch the dialer (#DEFAULT_KEYS_DIALER), execute a shortcut in your options menu without requiring the menu key be held down (#DEFAULT_KEYS_SHORTCUT), or launch a search (#DEFAULT_KEYS_SEARCH_LOCAL and #DEFAULT_KEYS_SEARCH_GLOBAL).

Note that the mode selected here does not impact the default handling of system keys, such as the "back" and "menu" keys, and your activity and its views always get a first chance to receive and handle all application keys.

Java documentation for android.app.Activity.setDefaultKeyMode(int).

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

See also

  • <xref:Android.App.Activity.OnKeyDown(Android.Views.Keycode%2c+Android.Views.KeyEvent)>