SequenceableBuiltinKeyEvent, KeyBoardEventpublic abstract class KeyEvent extends MultimodalEvent
This class extends the MultimodalEvent class. It defines the keycodes and methods
for various key events.
The keycodes are as follows:
NOW_MAX_KEY: keycodes for vehicle keys
MultimodalEventSystemCapability.MultimodalInput#MULTIMODAL_INPUTSequenceable.Producer<T>| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static int |
KEY_0 |
Keycode constant: '0' key
|
static int |
KEY_1 |
Keycode constant: '1' key
|
static int |
KEY_2 |
Keycode constant: '2' key
|
static int |
KEY_3 |
Keycode constant: '3' key
|
static int |
KEY_4 |
Keycode constant: '4' key
|
static int |
KEY_5 |
Keycode constant: '5' key
|
static int |
KEY_6 |
Keycode constant: '6' key
|
static int |
KEY_7 |
Keycode constant: '7' key
|
static int |
KEY_8 |
Keycode constant: '8' key
|
static int |
KEY_9 |
Keycode constant: '9' key
|
static int |
KEY_A |
Keycode constant: 'A' key
|
static int |
KEY_ALT_LEFT |
Keycode constant: Left Alt modifier key
|
static int |
KEY_ALT_RIGHT |
Keycode constant: Right Alt modifier key
|
static int |
KEY_APOSTROPHE |
Keycode constant: ''' key (apostrophe key)
|
static int |
KEY_AT |
Keycode constant: '@' key
|
static int |
KEY_B |
Keycode constant: 'B' key
|
static int |
KEY_BACK |
Keycode constant: Back key
|
static int |
KEY_BACKSLASH |
Keycode constant: '\' key
|
static int |
KEY_BREAK |
Keycode constant: Break/Pause key
|
static int |
KEY_BRIGHTNESS_DOWN |
Brightness Down key
|
static int |
KEY_BRIGHTNESS_UP |
Brightness UP key
|
static int |
KEY_C |
Keycode constant: 'C' key
|
static int |
KEY_CALL |
Keycode constant: Call key
|
static int |
KEY_CAMERA |
Presses the camera key.
|
static int |
KEY_CAPS_LOCK |
Keycode constant: Caps Lock key
|
static int |
KEY_CLEAR |
Keycode constant: Clear key
|
static int |
KEY_COMMA |
Keycode constant: ',' key
|
static int |
KEY_CTRL_LEFT |
Keycode constant: Left Control modifier key
|
static int |
KEY_CTRL_RIGHT |
Keycode constant: Right Control modifier key
|
static int |
KEY_CUSTOM1 |
Custom key 1
|
static int |
KEY_D |
Keycode constant: 'D' key
|
static int |
KEY_DEL |
Keycode constant: Backspace key
|
static int |
KEY_DPAD_CENTER |
Keycode constant: Directional Pad Center key
|
static int |
KEY_DPAD_DOWN |
Keycode constant: Directional Pad Down key
|
static int |
KEY_DPAD_LEFT |
Keycode constant: Directional Pad Left key
|
static int |
KEY_DPAD_RIGHT |
Keycode constant: Directional Pad Right key
|
static int |
KEY_DPAD_UP |
Keycode constant: Directional Pad Up key
|
static int |
KEY_E |
Keycode constant: 'E' key
|
static int |
KEY_ENDCALL |
Keycode constant: End Call key
|
static int |
KEY_ENTER |
Keycode constant: Enter key
|
static int |
KEY_ENVELOPE |
Keycode constant: Email function key
|
static int |
KEY_EQUALS |
Keycode constant: '=' key
|
static int |
KEY_ESCAPE |
Keycode constant: Escape key
|
static int |
KEY_EXPLORER |
Keycode constant: Explorer function key
|
static int |
KEY_F |
Keycode constant: 'F' key
|
static int |
KEY_F1 |
Keycode constant: F1 key
|
static int |
KEY_F10 |
Keycode constant: F10 key
|
static int |
KEY_F11 |
Keycode constant: F11 key
|
static int |
KEY_F12 |
Keycode constant: F12 key
|
static int |
KEY_F2 |
Keycode constant: F2 key
|
static int |
KEY_F3 |
Keycode constant: F3 key
|
static int |
KEY_F4 |
Keycode constant: F4 key
|
static int |
KEY_F5 |
Keycode constant: F5 key
|
static int |
KEY_F6 |
Keycode constant: F6 key
|
static int |
KEY_F7 |
Keycode constant: F7 key
|
static int |
KEY_F8 |
Keycode constant: F8 key
|
static int |
KEY_F9 |
Keycode constant: F9 key
|
static int |
KEY_FOCUS |
Keycode constant: Camera Focus key
|
static int |
KEY_FORWARD |
Keycode constant: Forward key
|
static int |
KEY_FORWARD_DEL |
Keycode constant: Forward Delete key
|
static int |
KEY_FUNCTION |
Keycode constant: Function modifier key
|
static int |
KEY_G |
Keycode constant: 'G' key
|
static int |
KEY_GRAVE |
Keycode constant: '`' key (backtick key)
|
static int |
KEY_H |
Keycode constant: 'H' key
|
static int |
KEY_HEADSETHOOK |
Keycode constant: Headset Hook key
|
static int |
KEY_HOME |
Keycode constant: Home key
|
static int |
KEY_I |
Keycode constant: 'I' key
|
static int |
KEY_INSERT |
Keycode constant: Insert key
|
static int |
KEY_J |
Keycode constant: 'J' key
|
static int |
KEY_K |
Keycode constant: 'K' key
|
static int |
KEY_L |
Keycode constant: 'L' key
|
static int |
KEY_LAUNCHER_MENU |
Menu key
|
static int |
KEY_LEFT_BRACKET |
Keycode constant: '[' key
|
static int |
KEY_LEFT_KNOB |
Left Knob
|
static int |
KEY_LEFT_KNOB_ROLL_DOWN |
Left Knob roll-down
|
static int |
KEY_LEFT_KNOB_ROLL_UP |
Left Knob roll-up
|
static int |
KEY_M |
Keycode constant: 'M' key
|
static int |
KEY_MEDIA_CLOSE |
Keycode constant: Close media key
|
static int |
KEY_MEDIA_EJECT |
Keycode constant: Eject media key
|
static int |
KEY_MEDIA_FAST_FORWARD |
Keycode constant: Fast Forward media key
|
static int |
KEY_MEDIA_NEXT |
Keycode constant: Play Next media key
|
static int |
KEY_MEDIA_PAUSE |
Keycode constant: Pause media key
|
static int |
KEY_MEDIA_PLAY |
Keycode constant: Play media key
|
static int |
KEY_MEDIA_PLAY_PAUSE |
Keycode constant: Play/Pause media key
|
static int |
KEY_MEDIA_PREVIOUS |
Keycode constant: Play Previous media key
|
static int |
KEY_MEDIA_RECORD |
Keycode constant: Record media key
|
static int |
KEY_MEDIA_REWIND |
Keycode constant: Rewind media key
|
static int |
KEY_MEDIA_STOP |
Keycode constant: Stop media key
|
static int |
KEY_MENU |
Keycode constant: Menu key
|
static int |
KEY_META_LEFT |
Keycode constant: Left Meta modifier key
|
static int |
KEY_META_RIGHT |
Keycode constant: Right Meta modifier key
|
static int |
KEY_MINUS |
Keycode constant: '-' key
|
static int |
KEY_MOVE_END |
Keycode constant: End Movement key
|
static int |
KEY_MOVE_HOME |
Keycode constant: Home Movement key
|
static int |
KEY_N |
Keycode constant: 'N' key
|
static int |
KEY_NOTIFICATION |
Keycode constant: Notification key
|
static int |
KEY_NUM_LOCK |
Keycode constant: Num Lock key
|
static int |
KEY_NUMPAD_0 |
Keycode constant: '0' key on the numeric keypad
|
static int |
KEY_NUMPAD_1 |
Keycode constant: '1' key on the numeric keypad
|
static int |
KEY_NUMPAD_2 |
Keycode constant: '2' key on the numeric keypad
|
static int |
KEY_NUMPAD_3 |
Keycode constant: '3' key on the numeric keypad
|
static int |
KEY_NUMPAD_4 |
Keycode constant: '4' key on the numeric keypad
|
static int |
KEY_NUMPAD_5 |
Keycode constant: '5' key on the numeric keypad
|
static int |
KEY_NUMPAD_6 |
Keycode constant: '6' key on the numeric keypad
|
static int |
KEY_NUMPAD_7 |
Keycode constant: '7' key on the numeric keypad
|
static int |
KEY_NUMPAD_8 |
Keycode constant: '8' key on the numeric keypad
|
static int |
KEY_NUMPAD_9 |
Keycode constant: '9' key on the numeric keypad
|
static int |
KEY_NUMPAD_ADD |
Keycode constant: '+' key (for addition) on the numeric keypad
|
static int |
KEY_NUMPAD_COMMA |
Key code constant: ',' key (for decimals or digit grouping) on the numeric keypad
|
static int |
KEY_NUMPAD_DIVIDE |
Keycode constant: '/' key (for division) on the numeric keypad
|
static int |
KEY_NUMPAD_DOT |
Key code constant: '.' key (for decimals or digit grouping) on the numeric keypad
|
static int |
KEY_NUMPAD_ENTER |
Keycode constant: Enter key on the numeric keypad
|
static int |
KEY_NUMPAD_EQUALS |
Keycode constant: '=' key on the numeric keypad
|
static int |
KEY_NUMPAD_LEFT_PAREN |
Keycode constant: '(' key on the numeric keypad
|
static int |
KEY_NUMPAD_MULTIPLY |
Keycode constant: '*' key (for multiplication) on the numeric keypad
|
static int |
KEY_NUMPAD_RIGHT_PAREN |
Keycode constant: ')' key on the numeric keypad
|
static int |
KEY_NUMPAD_SUBTRACT |
Keycode constant: '-' key (for subtraction) on the numeric keypad
|
static int |
KEY_O |
Keycode constant: 'O' key
|
static int |
KEY_P |
Keycode constant: 'P' key
|
static int |
KEY_PAGE_DOWN |
Keycode constant: Page Down key
|
static int |
KEY_PAGE_UP |
Keycode constant: Page Up key
|
static int |
KEY_PERIOD |
Keycode constant: '.' key
|
static int |
KEY_PLUS |
Keycode constant: '+' key
|
static int |
KEY_POUND |
Keycode constant: '#' key
|
static int |
KEY_POWER |
Presses the power button.
|
static int |
KEY_PRESSED |
Indicates that the key is being pressed down.
|
static int |
KEY_Q |
Keycode constant: 'Q' key
|
static int |
KEY_R |
Keycode constant: 'R' key
|
static int |
KEY_RELEASED |
Indicates that the key is being released.
|
static int |
KEY_RIGHT_BRACKET |
Keycode constant: ']' key
|
static int |
KEY_RIGHT_KNOB |
Right Knob
|
static int |
KEY_RIGHT_KNOB_ROLL_DOWN |
Right Knob roll-down
|
static int |
KEY_RIGHT_KNOB_ROLL_UP |
Right Knob roll-up
|
static int |
KEY_S |
Keycode constant: 'S' key
|
static int |
KEY_SCROLL_LOCK |
Keycode constant: Scroll Lock key
|
static int |
KEY_SEARCH |
Keycode constant: Search key
|
static int |
KEY_SEMICOLON |
Keycode constant: ';' key
|
static int |
KEY_SHIFT_LEFT |
Keycode constant: Left Shift modifier key
|
static int |
KEY_SHIFT_RIGHT |
Keycode constant: Right Shift modifier key
|
static int |
KEY_SLASH |
Keycode constant: '/' key
|
static int |
KEY_SPACE |
Keycode constant: Space key
|
static int |
KEY_STAR |
Keycode constant: '*' key
|
static int |
KEY_SYM |
Keycode constant: Symbol modifier key
|
static int |
KEY_SYSRQ |
Keycode constant: System Request/Print Screen key
|
static int |
KEY_T |
Keycode constant: 'T' key
|
static int |
KEY_TAB |
Keycode constant: Tab key
|
static int |
KEY_U |
Keycode constant: 'U' key
|
static int |
KEY_UNKNOWN |
Keycode constant: unknown keycode
|
static int |
KEY_V |
Keycode constant: 'V' key
|
static int |
KEY_VOICE_ASSISTANT |
Voice Assistant key
|
static int |
KEY_VOICE_SOURCE_SWITCH |
Audio Source Switch button
|
static int |
KEY_VOLUME_DOWN |
Turns down the volume.
|
static int |
KEY_VOLUME_MUTE |
Indicates that the volume is muted.
|
static int |
KEY_VOLUME_UP |
Turns up the volume.
|
static int |
KEY_W |
Keycode constant: 'W' key
|
static int |
KEY_WEAR_1 |
Indicates general-purpose key 1 on the wearables
|
static int |
KEY_X |
Keycode constant: 'X' key
|
static int |
KEY_Y |
Keycode constant: 'Y' key
|
static int |
KEY_Z |
Keycode constant: 'Z' key
|
static int |
NOW_MAX_KEY |
Keycode constant: max keycode
|
BUILTIN_KEY, DEFAULT_TYPE, highLevelEvent, KEYBOARD, MOUSE, ROTATION, SPEECH, STYLUS, TOUCH_PANEL, UNSUPPORTED_DEVICE, uuid| 构造器 | 说明 |
|---|---|
KeyEvent() |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
abstract int |
getKeyCode() |
Obtains the keycode of the current key event.
|
abstract long |
getKeyDownDuration() |
Obtains the duration during which the current key is pressed down before this method is
called.
|
static int |
getMaxKeyCode() |
Obtains the max keycode of the current key event.
|
abstract boolean |
isKeyDown() |
Obtains the press-down state of the current key.
|
getDeviceId, getInputDeviceId, getOccurredTime, getSourceDevice, getUuid, isSameEvent, marshalling, unmarshallingclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithasFileDescriptorpublic static final int KEY_0
public static final int KEY_1
public static final int KEY_2
public static final int KEY_3
public static final int KEY_4
public static final int KEY_5
public static final int KEY_6
public static final int KEY_7
public static final int KEY_8
public static final int KEY_9
public static final int KEY_A
public static final int KEY_ALT_LEFT
public static final int KEY_ALT_RIGHT
public static final int KEY_APOSTROPHE
public static final int KEY_AT
public static final int KEY_B
public static final int KEY_BACK
public static final int KEY_BACKSLASH
public static final int KEY_BREAK
public static final int KEY_BRIGHTNESS_DOWN
public static final int KEY_BRIGHTNESS_UP
public static final int KEY_C
public static final int KEY_CALL
public static final int KEY_CAMERA
It is used to start the camera or take photos.
public static final int KEY_CAPS_LOCK
public static final int KEY_CLEAR
public static final int KEY_COMMA
public static final int KEY_CTRL_LEFT
public static final int KEY_CTRL_RIGHT
public static final int KEY_CUSTOM1
The actions mapping to the custom keys are user-defined. Key values 521-529 are reserved for custom keys.
public static final int KEY_D
public static final int KEY_DEL
Unlike KEY_FORWARD_DEL, this key is used to delete characters before the
insertion point.
public static final int KEY_DPAD_CENTER
The key may also be synthesized from trackball motions.
public static final int KEY_DPAD_DOWN
The key may also be synthesized from trackball motions.
public static final int KEY_DPAD_LEFT
The key may also be synthesized from trackball motions.
public static final int KEY_DPAD_RIGHT
The key may also be synthesized from trackball motions.
public static final int KEY_DPAD_UP
The key may also be synthesized from trackball motions.
public static final int KEY_E
public static final int KEY_ENDCALL
public static final int KEY_ENTER
public static final int KEY_ENVELOPE
This key is used to launch an email application.
public static final int KEY_EQUALS
public static final int KEY_ESCAPE
public static final int KEY_EXPLORER
This key is used to launch a browser application.
public static final int KEY_F
public static final int KEY_F1
public static final int KEY_F10
public static final int KEY_F11
public static final int KEY_F12
public static final int KEY_F2
public static final int KEY_F3
public static final int KEY_F4
public static final int KEY_F5
public static final int KEY_F6
public static final int KEY_F7
public static final int KEY_F8
public static final int KEY_F9
public static final int KEY_FOCUS
This key is used to enable focus for the camera.
public static final int KEY_FORWARD
This key is used to navigate forward in the history stack. It is a complement of
KEY_BACK.
public static final int KEY_FORWARD_DEL
Unlike KEY_DEL, this key is used to delete characters ahead of the insertion
point.
public static final int KEY_FUNCTION
public static final int KEY_G
public static final int KEY_GRAVE
public static final int KEY_H
public static final int KEY_HEADSETHOOK
The key is used to end a call and stop media.
public static final int KEY_HOME
This key is processed by the framework and will never be sent to the application.
public static final int KEY_I
public static final int KEY_INSERT
This key is used to toggle the insert or overwrite edit mode.
public static final int KEY_J
public static final int KEY_K
public static final int KEY_L
public static final int KEY_LAUNCHER_MENU
Pressing this key will display the launcher page.
public static final int KEY_LEFT_BRACKET
public static final int KEY_LEFT_KNOB
Pressing the knob will activate its adjustment function.
public static final int KEY_LEFT_KNOB_ROLL_DOWN
In contrast to KEY_LEFT_KNOB_ROLL_UP, it means rolling the left knob downwards. The knob function
is scenario-specific, for example, reducing the volume or air conditioner temperature.
public static final int KEY_LEFT_KNOB_ROLL_UP
In contrast to KEY_LEFT_KNOB_ROLL_DOWN, it means rolling the left knob upwards. The knob function
is scenario-specific, for example, increasing the volume or air conditioner temperature.
public static final int KEY_M
public static final int KEY_MEDIA_CLOSE
This key can be used to close a CD tray, for example.
public static final int KEY_MEDIA_EJECT
This key can be used to eject a CD tray, for example.
public static final int KEY_MEDIA_FAST_FORWARD
public static final int KEY_MEDIA_NEXT
public static final int KEY_MEDIA_PAUSE
public static final int KEY_MEDIA_PLAY
public static final int KEY_MEDIA_PLAY_PAUSE
public static final int KEY_MEDIA_PREVIOUS
public static final int KEY_MEDIA_RECORD
public static final int KEY_MEDIA_REWIND
public static final int KEY_MEDIA_STOP
public static final int KEY_MENU
public static final int KEY_META_LEFT
public static final int KEY_META_RIGHT
public static final int KEY_MINUS
public static final int KEY_MOVE_END
This key is used to scroll or move the cursor around to the end of a line or to the bottom of a list.
public static final int KEY_MOVE_HOME
This key is used to scroll or move the cursor around to the start of a line or to the top of a list.
public static final int KEY_N
public static final int KEY_NOTIFICATION
public static final int KEY_NUMPAD_0
public static final int KEY_NUMPAD_1
public static final int KEY_NUMPAD_2
public static final int KEY_NUMPAD_3
public static final int KEY_NUMPAD_4
public static final int KEY_NUMPAD_5
public static final int KEY_NUMPAD_6
public static final int KEY_NUMPAD_7
public static final int KEY_NUMPAD_8
public static final int KEY_NUMPAD_9
public static final int KEY_NUMPAD_ADD
public static final int KEY_NUMPAD_COMMA
public static final int KEY_NUMPAD_DIVIDE
public static final int KEY_NUMPAD_DOT
public static final int KEY_NUMPAD_ENTER
public static final int KEY_NUMPAD_EQUALS
public static final int KEY_NUMPAD_LEFT_PAREN
public static final int KEY_NUMPAD_MULTIPLY
public static final int KEY_NUMPAD_RIGHT_PAREN
public static final int KEY_NUMPAD_SUBTRACT
public static final int KEY_NUM_LOCK
This key is used to alter the behavior of other keys on the numeric keypad.
public static final int KEY_O
public static final int KEY_P
public static final int KEY_PAGE_DOWN
public static final int KEY_PAGE_UP
public static final int KEY_PERIOD
public static final int KEY_PLUS
public static final int KEY_POUND
public static final int KEY_POWER
public static final int KEY_PRESSED
public static final int KEY_Q
public static final int KEY_R
public static final int KEY_RELEASED
public static final int KEY_RIGHT_BRACKET
public static final int KEY_RIGHT_KNOB
Pressing the knob will activate its adjustment function.
public static final int KEY_RIGHT_KNOB_ROLL_DOWN
In contrast to KEY_RIGHT_KNOB_ROLL_UP, it means rolling the right knob downwards. The knob
function is scenario-specific, for example, reducing the volume or air conditioner temperature.
public static final int KEY_RIGHT_KNOB_ROLL_UP
In contrast to KEY_RIGHT_KNOB_ROLL_DOWN, it means rolling the right knob upwards. The knob
function is scenario-specific, for example, increasing the volume or air conditioner temperature.
public static final int KEY_S
public static final int KEY_SCROLL_LOCK
public static final int KEY_SEARCH
public static final int KEY_SEMICOLON
public static final int KEY_SHIFT_LEFT
public static final int KEY_SHIFT_RIGHT
public static final int KEY_SLASH
public static final int KEY_SPACE
public static final int KEY_STAR
public static final int KEY_SYM
The key is used to input alternate symbols.
public static final int KEY_SYSRQ
public static final int KEY_T
public static final int KEY_TAB
public static final int KEY_U
public static final int KEY_UNKNOWN
The keycode is unknown.
public static final int KEY_V
public static final int KEY_VOICE_ASSISTANT
This key is used to wake up the voice assistant.
public static final int KEY_VOICE_SOURCE_SWITCH
Pressing this button will enable the audio source. Depending on the actual scenario, it may also indicate that the Bluetooth call control button is pressed.
public static final int KEY_VOLUME_DOWN
public static final int KEY_VOLUME_MUTE
public static final int KEY_VOLUME_UP
public static final int KEY_W
public static final int KEY_WEAR_1
public static final int KEY_X
public static final int KEY_Y
public static final int KEY_Z
public static final int NOW_MAX_KEY
If a new keycode added to KeyEvent is greater than the maximum keycode, update
the maximum keycode accordingly.
public static int getMaxKeyCode()
public abstract boolean isKeyDown()
true if the current key is pressed down; returns false
otherwise.public abstract int getKeyCode()
KEY_UNKNOWN if the keycode
cannot be obtained.getMaxKeyCode()public abstract long getKeyDownDuration()
0 if the current key has not been pressed down.