Aracılığıyla paylaş


KeyEvent.HasModifiers(MetaKeyStates) Method

Definition

Returns true if only the specified modifiers keys are pressed.

[Android.Runtime.Register("hasModifiers", "(I)Z", "")]
public bool HasModifiers (Android.Views.MetaKeyStates modifiers);
[<Android.Runtime.Register("hasModifiers", "(I)Z", "")>]
member this.HasModifiers : Android.Views.MetaKeyStates -> bool

Parameters

modifiers
MetaKeyStates

The meta state of the modifier keys to check. May be a combination of modifier meta states as defined by #getModifierMetaStateMask(). May be 0 to ensure that no modifier keys are pressed.

Returns

True if only the specified modifier keys are pressed.

Attributes

Exceptions

if the modifiers parameter contains invalid modifiers

Remarks

Returns true if only the specified modifiers keys are pressed. Returns false if a different combination of modifier keys are pressed.

For the purposes of this function, #KEYCODE_CAPS_LOCK, #KEYCODE_SCROLL_LOCK, and #KEYCODE_NUM_LOCK are not considered modifier keys. Consequently, this function ignores #META_CAPS_LOCK_ON, #META_SCROLL_LOCK_ON and #META_NUM_LOCK_ON.

If the specified modifier mask includes directional modifiers, such as #META_SHIFT_LEFT_ON, then this method ensures that the modifier is pressed on that side. If the specified modifier mask includes non-directional modifiers, such as #META_SHIFT_ON, then this method ensures that the modifier is pressed on either side. If the specified modifier mask includes both directional and non-directional modifiers for the same type of key, such as #META_SHIFT_ON and #META_SHIFT_LEFT_ON, then this method throws an illegal argument exception.

Java documentation for android.view.KeyEvent.hasModifiers(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.Views.KeyEvent.MetaStateHasModifiers(Android.Views.MetaKeyStates%2c+Android.Views.MetaKeyStates)>