安卓dispatchtoucheventkeyevent源码在哪

2015年2月 移动开发大版内专家分月排行榜第二
2015年4月 移动开发大版内专家分月排行榜第三2015年1月 移动开发大版内专家分月排行榜第三
匿名用户不能发表回复!|Android手机输入法按键监听-dispatchKeyEvent
最近在项目开发中遇到一个关于手机输入键盘的坑,特来记录下。
应用场景:
项目中有一个界面是用viewpaper加三个fragment写的,其中viewpaper被我屏蔽了左右滑动,上面有三个点击按钮,点击他们可以切
最近在项目开发中遇到一个关于手机输入键盘的坑,特来记录下。
应用场景:
项目中有一个界面是用viewpaper加三个fragment写的,其中viewpaper被我屏蔽了左右滑动,上面有三个点击按钮,点击他们可以切换页面(不要问我为什么这么写,因为你不知道需求有多么的操蛋)。每个fragment里面都有五六个竖着排列的edittext。只有一个fragment里面的edittext都填写了才让跳到下一个。大致效果图如下:
vc/ysLTFpaGjxuTL+8rWu/q/ycTc1rvT0MG9uPajrLK7zazK1rv6v8nE3LK70rvR+aGjtbG147v3y8S49rC0xaW1xMqxuvK74beiz9a958PmxNy5u8nPz8LX89PSzPjXqqOsxNy007Xa0ru49mZyYWdtZW50zPi1vbXatv649mZyYWdtZW50oaOho6Gj0rK+zcrHy7XF0LbPZWRpdHRleHTKx7fxzO7QtLXExdC2z87e0KfBy6GjvfvWubustq/Sss7e0KfBy6Oho6GjoTwvcD4NCjxwPjxzdHJvbmc+veK+9re9t6g8L3N0cm9uZz6jujxiciAvPg0K1tjQtEFjdGl2aXR51tC1xGRpc3BhdGNoS2V5RXZlbnTKwrz+yLu687bU06awtLz8vfjQ0LSmwO2jujwvcD4NCjxwcmUgY2xhc3M9"brush:">
public boolean dispatchKeyEvent(KeyEvent event) {
// TODO Auto-generated method stub
if (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_LEFT
|| event.getKeyCode() == KeyEvent.KEYCODE_DPAD_UP
|| event.getKeyCode() == KeyEvent.KEYCODE_DPAD_RIGHT
|| event.getKeyCode() == KeyEvent.KEYCODE_DPAD_DOWN) {
return super.dispatchKeyEvent(event);
KEYCODE_DPAD_LEFT (21)、KEYCODE_DPAD_UP (19)、KEYCODE_DPAD_RIGHT (22)、KEYCODE_DPAD_DOWN (20)这四个值对应的就是键盘上的四个按钮(左、上、右、下)的值。这里我的处理方案是直接给屏蔽了他的点击事件,相应的处理逻辑可以自己写。
这里还有一点要说下:
如上图这里键盘也有自带的上下左右用于粘贴复制等操作,这四个键的keyCode跟上面四个的是一样的。不过有一点不同,就是当editText里面没有写东西的时候会检测不到按键。
再说下dispatchKeyEvent:
当键盘按下时的触发顺序 -& dispatchKeyEvent && onUserInteraction && onKeyDown
如果按下紧接着松开,则是触发两次。紧跟再触发&& dispatchKeyEvent && onUserInteraction
dispatchKeyEvent是做按键处理和分发的工作,如果你想要onKeyDown还可以接收到应该这样实现
public boolean dispatchKeyEvent(KeyEvent event){
return super.dispatchKeyEvent(event);
最后给大家附上键盘按键的code值:
/** Key code constant: Unknown key code. */
public static final int KEYCODE_UNKNOWN
/** Key code constant: Soft Left key.
* Usually situated below the display on phones and used as a multi-function
* feature key for selecting a software defined function shown on the bottom left
* of the display. */
public static final int KEYCODE_SOFT_LEFT
/** Key code constant: Soft Right key.
* Usually situated below the display on phones and used as a multi-function
* feature key for selecting a software defined function shown on the bottom right
* of the display. */
public static final int KEYCODE_SOFT_RIGHT
/** Key code constant: Home key.
* This key is handled by the framework and is never delivered to applications. */
public static final int KEYCODE_HOME
/** Key code constant: Back key. */
public static final int KEYCODE_BACK
/** Key code constant: Call key. */
public static final int KEYCODE_CALL
/** Key code constant: End Call key. */
public static final int KEYCODE_ENDCALL
/** Key code constant: '0' key. */
public static final int KEYCODE_0
/** Key code constant: '1' key. */
public static final int KEYCODE_1
/** Key code constant: '2' key. */
public static final int KEYCODE_2
/** Key code constant: '3' key. */
public static final int KEYCODE_3
/** Key code constant: '4' key. */
public static final int KEYCODE_4
/** Key code constant: '5' key. */
public static final int KEYCODE_5
/** Key code constant: '6' key. */
public static final int KEYCODE_6
/** Key code constant: '7' key. */
public static final int KEYCODE_7
/** Key code constant: '8' key. */
public static final int KEYCODE_8
/** Key code constant: '9' key. */
public static final int KEYCODE_9
/** Key code constant: '*' key. */
public static final int KEYCODE_STAR
/** Key code constant: '#' key. */
public static final int KEYCODE_POUND
/** Key code constant: Directional Pad Up key.
* May also be synthesized from trackball motions. */
public static final int KEYCODE_DPAD_UP
/** Key code constant: Directional Pad Down key.
* May also be synthesized from trackball motions. */
public static final int KEYCODE_DPAD_DOWN
/** Key code constant: Directional Pad Left key.
* May also be synthesized from trackball motions. */
public static final int KEYCODE_DPAD_LEFT
/** Key code constant: Directional Pad Right key.
* May also be synthesized from trackball motions. */
public static final int KEYCODE_DPAD_RIGHT
/** Key code constant: Directional Pad Center key.
* May also be synthesized from trackball motions. */
public static final int KEYCODE_DPAD_CENTER
/** Key code constant: Volume Up key.
* Adjusts the speaker volume up. */
public static final int KEYCODE_VOLUME_UP
/** Key code constant: Volume Down key.
* Adjusts the speaker volume down. */
public static final int KEYCODE_VOLUME_DOWN
/** Key code constant: Power key. */
public static final int KEYCODE_POWER
/** Key code constant: Camera key.
* Used to launch a camera application or take pictures. */
public static final int KEYCODE_CAMERA
/** Key code constant: Clear key. */
public static final int KEYCODE_CLEAR
/** Key code constant: 'A' key. */
public static final int KEYCODE_A
/** Key code constant: 'B' key. */
public static final int KEYCODE_B
/** Key code constant: 'C' key. */
public static final int KEYCODE_C
/** Key code constant: 'D' key. */
public static final int KEYCODE_D
/** Key code constant: 'E' key. */
public static final int KEYCODE_E
/** Key code constant: 'F' key. */
public static final int KEYCODE_F
/** Key code constant: 'G' key. */
public static final int KEYCODE_G
/** Key code constant: 'H' key. */
public static final int KEYCODE_H
/** Key code constant: 'I' key. */
public static final int KEYCODE_I
/** Key code constant: 'J' key. */
public static final int KEYCODE_J
/** Key code constant: 'K' key. */
public static final int KEYCODE_K
/** Key code constant: 'L' key. */
public static final int KEYCODE_L
/** Key code constant: 'M' key. */
public static final int KEYCODE_M
/** Key code constant: 'N' key. */
public static final int KEYCODE_N
/** Key code constant: 'O' key. */
public static final int KEYCODE_O
/** Key code constant: 'P' key. */
public static final int KEYCODE_P
/** Key code constant: 'Q' key. */
public static final int KEYCODE_Q
/** Key code constant: 'R' key. */
public static final int KEYCODE_R
/** Key code constant: 'S' key. */
public static final int KEYCODE_S
/** Key code constant: 'T' key. */
public static final int KEYCODE_T
/** Key code constant: 'U' key. */
public static final int KEYCODE_U
/** Key code constant: 'V' key. */
public static final int KEYCODE_V
/** Key code constant: 'W' key. */
public static final int KEYCODE_W
/** Key code constant: 'X' key. */
public static final int KEYCODE_X
/** Key code constant: 'Y' key. */
public static final int KEYCODE_Y
/** Key code constant: 'Z' key. */
public static final int KEYCODE_Z
/** Key code constant: ',' key. */
public static final int KEYCODE_COMMA
/** Key code constant: '.' key. */
public static final int KEYCODE_PERIOD
/** Key code constant: Left Alt modifier key. */
public static final int KEYCODE_ALT_LEFT
/** Key code constant: Right Alt modifier key. */
public static final int KEYCODE_ALT_RIGHT
/** Key code constant: Left Shift modifier key. */
public static final int KEYCODE_SHIFT_LEFT
/** Key code constant: Right Shift modifier key. */
public static final int KEYCODE_SHIFT_RIGHT
/** Key code constant: Tab key. */
public static final int KEYCODE_TAB
/** Key code constant: Space key. */
public static final int KEYCODE_SPACE
/** Key code constant: Symbol modifier key.
* Used to enter alternate symbols. */
public static final int KEYCODE_SYM
/** Key code constant: Explorer special function key.
* Used to launch a browser application. */
public static final int KEYCODE_EXPLORER
/** Key code constant: Envelope special function key.
* Used to launch a mail application. */
public static final int KEYCODE_ENVELOPE
/** Key code constant: Enter key. */
public static final int KEYCODE_ENTER
/** Key code constant: Backspace key.
* Deletes characters before the insertion point, unlike {@link #KEYCODE_FORWARD_DEL}. */
public static final int KEYCODE_DEL
/** Key code constant: '`' (backtick) key. */
public static final int KEYCODE_GRAVE
/** Key code constant: '-'. */
public static final int KEYCODE_MINUS
/** Key code constant: '=' key. */
public static final int KEYCODE_EQUALS
/** Key code constant: '[' key. */
public static final int KEYCODE_LEFT_BRACKET
/** Key code constant: ']' key. */
public static final int KEYCODE_RIGHT_BRACKET
/** Key code constant: '\' key. */
public static final int KEYCODE_BACKSLASH
/** Key code constant: ';' key. */
public static final int KEYCODE_SEMICOLON
/** Key code constant: ''' (apostrophe) key. */
public static final int KEYCODE_APOSTROPHE
/** Key code constant: '/' key. */
public static final int KEYCODE_SLASH
/** Key code constant: '@' key. */
public static final int KEYCODE_AT
/** Key code constant: Number modifier key.
* Used to enter numeric symbols.
* This key is not Num L it is more like {@link #KEYCODE_ALT_LEFT} and is
* interpreted as an ALT key by {@link android.text.method.MetaKeyKeyListener}. */
public static final int KEYCODE_NUM
/** Key code constant: Headset Hook key.
* Used to hang up calls and stop media. */
public static final int KEYCODE_HEADSETHOOK
/** Key code constant: Camera Focus key.
* Used to focus the camera. */
public static final int KEYCODE_FOCUS
// *Camera* focus
/** Key code constant: '+' key. */
public static final int KEYCODE_PLUS
/** Key code constant: Menu key. */
public static final int KEYCODE_MENU
/** Key code constant: Notification key. */
public static final int KEYCODE_NOTIFICATION
/** Key code constant: Search key. */
public static final int KEYCODE_SEARCH
/** Key code constant: Play/Pause media key. */
public static final int KEYCODE_MEDIA_PLAY_PAUSE= 85;
/** Key code constant: Stop media key. */
public static final int KEYCODE_MEDIA_STOP
/** Key code constant: Play Next media key. */
public static final int KEYCODE_MEDIA_NEXT
/** Key code constant: Play Previous media key. */
public static final int KEYCODE_MEDIA_PREVIOUS
/** Key code constant: Rewind media key. */
public static final int KEYCODE_MEDIA_REWIND
/** Key code constant: Fast Forward media key. */
public static final int KEYCODE_MEDIA_FAST_FORWARD = 90;
/** Key code constant: Mute key.
* Mutes the microphone, unlike {@link #KEYCODE_VOLUME_MUTE}. */
public static final int KEYCODE_MUTE
/** Key code constant: Page Up key. */
public static final int KEYCODE_PAGE_UP
/** Key code constant: Page Down key. */
public static final int KEYCODE_PAGE_DOWN
/** Key code constant: Picture Symbols modifier key.
* Used to switch symbol sets (Emoji, Kao-moji). */
public static final int KEYCODE_PICTSYMBOLS
// switch symbol-sets (Emoji,Kao-moji)
/** Key code constant: Switch Charset modifier key.
* Used to switch character sets (Kanji, Katakana). */
public static final int KEYCODE_SWITCH_CHARSET
// switch char-sets (Kanji,Katakana)
/** Key code constant: A Button key.
* On a game controller, the A button should be either the button labeled A
* or the first button on the bottom row of controller buttons. */
public static final int KEYCODE_BUTTON_A
/** Key code constant: B Button key.
* On a game controller, the B button should be either the button labeled B
* or the second button on the bottom row of controller buttons. */
public static final int KEYCODE_BUTTON_B
/** Key code constant: C Button key.
* On a game controller, the C button should be either the button labeled C
* or the third button on the bottom row of controller buttons. */
public static final int KEYCODE_BUTTON_C
/** Key code constant: X Button key.
* On a game controller, the X button should be either the button labeled X
* or the first button on the upper row of controller buttons. */
public static final int KEYCODE_BUTTON_X
/** Key code constant: Y Button key.
* On a game controller, the Y button should be either the button labeled Y
* or the second button on the upper row of controller buttons. */
public static final int KEYCODE_BUTTON_Y
/** Key code constant: Z Button key.
* On a game controller, the Z button should be either the button labeled Z
* or the third button on the upper row of controller buttons. */
public static final int KEYCODE_BUTTON_Z
/** Key code constant: L1 Button key.
* On a game controller, the L1 button should be either the button labeled L1 (or L)
* or the top left trigger button. */
public static final int KEYCODE_BUTTON_L1
/** Key code constant: R1 Button key.
* On a game controller, the R1 button should be either the button labeled R1 (or R)
* or the top right trigger button. */
public static final int KEYCODE_BUTTON_R1
/** Key code constant: L2 Button key.
* On a game controller, the L2 button should be either the button labeled L2
* or the bottom left trigger button. */
public static final int KEYCODE_BUTTON_L2
/** Key code constant: R2 Button key.
* On a game controller, the R2 button should be either the button labeled R2
* or the bottom right trigger button. */
public static final int KEYCODE_BUTTON_R2
/** Key code constant: Left Thumb Button key.
* On a game controller, the left thumb button indicates that the left (or only)
* joystick is pressed. */
public static final int KEYCODE_BUTTON_THUMBL
/** Key code constant: Right Thumb Button key.
* On a game controller, the right thumb button indicates that the right
* joystick is pressed. */
public static final int KEYCODE_BUTTON_THUMBR
/** Key code constant: Start Button key.
* On a game controller, the button labeled Start. */
public static final int KEYCODE_BUTTON_START
/** Key code constant: Select Button key.
* On a game controller, the button labeled Select. */
public static final int KEYCODE_BUTTON_SELECT
/** Key code constant: Mode Button key.
* On a game controller, the button labeled Mode. */
public static final int KEYCODE_BUTTON_MODE
/** Key code constant: Escape key. */
public static final int KEYCODE_ESCAPE
/** Key code constant: Forward Delete key.
* Deletes characters ahead of the insertion point, unlike {@link #KEYCODE_DEL}. */
public static final int KEYCODE_FORWARD_DEL
/** Key code constant: Left Control modifier key. */
public static final int KEYCODE_CTRL_LEFT
/** Key code constant: Right Control modifier key. */
public static final int KEYCODE_CTRL_RIGHT
/** Key code constant: Caps Lock key. */
public static final int KEYCODE_CAPS_LOCK
/** Key code constant: Scroll Lock key. */
public static final int KEYCODE_SCROLL_LOCK
/** Key code constant: Left Meta modifier key. */
public static final int KEYCODE_META_LEFT
/** Key code constant: Right Meta modifier key. */
public static final int KEYCODE_META_RIGHT
/** Key code constant: Function modifier key. */
public static final int KEYCODE_FUNCTION
/** Key code constant: System Request / Print Screen key. */
public static final int KEYCODE_SYSRQ
/** Key code constant: Break / Pause key. */
public static final int KEYCODE_BREAK
/** Key code constant: Home Movement key.
* Used for scrolling or moving the cursor around to the start of a line
* or to the top of a list. */
public static final int KEYCODE_MOVE_HOME
/** Key code constant: End Movement key.
* Used for scrolling or moving the cursor around to the end of a line
* or to the bottom of a list. */
public static final int KEYCODE_MOVE_END
/** Key code constant: Insert key.
* Toggles insert / overwrite edit mode. */
public static final int KEYCODE_INSERT
/** Key code constant: Forward key.
* Navigates forward in the history stack.
Complement of {@link #KEYCODE_BACK}. */
public static final int KEYCODE_FORWARD
/** Key code constant: Play media key. */
public static final int KEYCODE_MEDIA_PLAY
/** Key code constant: Pause media key. */
public static final int KEYCODE_MEDIA_PAUSE
/** Key code constant: Close media key.
* May be used to close a CD tray, for example. */
public static final int KEYCODE_MEDIA_CLOSE
/** Key code constant: Eject media key.
* May be used to eject a CD tray, for example. */
public static final int KEYCODE_MEDIA_EJECT
/** Key code constant: Record media key. */
public static final int KEYCODE_MEDIA_RECORD
/** Key code constant: F1 key. */
public static final int KEYCODE_F1
/** Key code constant: F2 key. */
public static final int KEYCODE_F2
/** Key code constant: F3 key. */
public static final int KEYCODE_F3
/** Key code constant: F4 key. */
public static final int KEYCODE_F4
/** Key code constant: F5 key. */
public static final int KEYCODE_F5
/** Key code constant: F6 key. */
public static final int KEYCODE_F6
/** Key code constant: F7 key. */
public static final int KEYCODE_F7
/** Key code constant: F8 key. */
public static final int KEYCODE_F8
/** Key code constant: F9 key. */
public static final int KEYCODE_F9
/** Key code constant: F10 key. */
public static final int KEYCODE_F10
/** Key code constant: F11 key. */
public static final int KEYCODE_F11
/** Key code constant: F12 key. */
public static final int KEYCODE_F12
/** Key code constant: Num Lock key.
* This is the Num L it is different from {@link #KEYCODE_NUM}.
* This key alters the behavior of other keys on the numeric keypad. */
public static final int KEYCODE_NUM_LOCK
/** Key code constant: Numeric keypad '0' key. */
public static final int KEYCODE_NUMPAD_0
/** Key code constant: Numeric keypad '1' key. */
public static final int KEYCODE_NUMPAD_1
/** Key code constant: Numeric keypad '2' key. */
public static final int KEYCODE_NUMPAD_2
/** Key code constant: Numeric keypad '3' key. */
public static final int KEYCODE_NUMPAD_3
/** Key code constant: Numeric keypad '4' key. */
public static final int KEYCODE_NUMPAD_4
/** Key code constant: Numeric keypad '5' key. */
public static final int KEYCODE_NUMPAD_5
/** Key code constant: Numeric keypad '6' key. */
public static final int KEYCODE_NUMPAD_6
/** Key code constant: Numeric keypad '7' key. */
public static final int KEYCODE_NUMPAD_7
/** Key code constant: Numeric keypad '8' key. */
public static final int KEYCODE_NUMPAD_8
/** Key code constant: Numeric keypad '9' key. */
public static final int KEYCODE_NUMPAD_9
/** Key code constant: Numeric keypad '/' key (for division). */
public static final int KEYCODE_NUMPAD_DIVIDE
/** Key code constant: Numeric keypad '*' key (for multiplication). */
public static final int KEYCODE_NUMPAD_MULTIPLY = 155;
/** Key code constant: Numeric keypad '-' key (for subtraction). */
public static final int KEYCODE_NUMPAD_SUBTRACT = 156;
/** Key code constant: Numeric keypad '+' key (for addition). */
public static final int KEYCODE_NUMPAD_ADD
/** Key code constant: Numeric keypad '.' key (for decimals or digit grouping). */
public static final int KEYCODE_NUMPAD_DOT
/** Key code constant: Numeric keypad ',' key (for decimals or digit grouping). */
public static final int KEYCODE_NUMPAD_COMMA
/** Key code constant: Numeric keypad Enter key. */
public static final int KEYCODE_NUMPAD_ENTER
/** Key code constant: Numeric keypad '=' key. */
public static final int KEYCODE_NUMPAD_EQUALS
/** Key code constant: Numeric keypad '(' key. */
public static final int KEYCODE_NUMPAD_LEFT_PAREN = 162;
/** Key code constant: Numeric keypad ')' key. */
public static final int KEYCODE_NUMPAD_RIGHT_PAREN = 163;
/** Key code constant: Volume Mute key.
* Mutes the speaker, unlike {@link #KEYCODE_MUTE}.
* This key should normally be implemented as a toggle such that the first press
* mutes the speaker and the second press restores the original volume. */
public static final int KEYCODE_VOLUME_MUTE
/** Key code constant: Info key.
* Common on TV remotes to show additional information related to what is
* currently being viewed. */
public static final int KEYCODE_INFO
/** Key code constant: Channel up key.
* On TV remotes, increments the television channel. */
public static final int KEYCODE_CHANNEL_UP
/** Key code constant: Channel down key.
* On TV remotes, decrements the television channel. */
public static final int KEYCODE_CHANNEL_DOWN
/** Key code constant: Zoom in key. */
public static final int KEYCODE_ZOOM_IN
/** Key code constant: Zoom out key. */
public static final int KEYCODE_ZOOM_OUT
/** Key code constant: TV key.
* On TV remotes, switches to viewing live TV. */
public static final int KEYCODE_TV
/** Key code constant: Window key.
* On TV remotes, toggles picture-in-picture mode or other windowing functions. */
public static final int KEYCODE_WINDOW
/** Key code constant: Guide key.
* On TV remotes, shows a programming guide. */
public static final int KEYCODE_GUIDE
/** Key code constant: DVR key.
* On some TV remotes, switches to a DVR mode for recorded shows. */
public static final int KEYCODE_DVR
/** Key code constant: Bookmark key.
* On some TV remotes, bookmarks content or web pages. */
public static final int KEYCODE_BOOKMARK
/** Key code constant: Toggle captions key.
* Switches the mode for closed-captioning text, for example during television shows. */
public static final int KEYCODE_CAPTIONS
/** Key code constant: Settings key.
* Starts the system settings activity. */
public static final int KEYCODE_SETTINGS
/** Key code constant: TV power key.
* On TV remotes, toggles the power on a television screen. */
public static final int KEYCODE_TV_POWER
/** Key code constant: TV input key.
* On TV remotes, switches the input on a television screen. */
public static final int KEYCODE_TV_INPUT
/** Key code constant: Set-top-box power key.
* On TV remotes, toggles the power on an external Set-top-box. */
public static final int KEYCODE_STB_POWER
/** Key code constant: Set-top-box input key.
* On TV remotes, switches the input mode on an external Set-top-box. */
public static final int KEYCODE_STB_INPUT
/** Key code constant: A/V Receiver power key.
* On TV remotes, toggles the power on an external A/V Receiver. */
public static final int KEYCODE_AVR_POWER
/** Key code constant: A/V Receiver input key.
* On TV remotes, switches the input mode on an external A/V Receiver. */
public static final int KEYCODE_AVR_INPUT
/** Key code constant: Red "programmable" key.
* On TV remotes, acts as a contextual/programmable key. */
public static final int KEYCODE_PROG_RED
/** Key code constant: Green "programmable" key.
* On TV remotes, actsas a contextual/programmable key. */
public static final int KEYCODE_PROG_GREEN
/** Key code constant: Yellow "programmable" key.
* On TV remotes, acts as a contextual/programmable key. */
public static final int KEYCODE_PROG_YELLOW
/** Key code constant: Blue "programmable" key.
* On TV remotes, acts as a contextual/programmable key. */
public static final int KEYCODE_PROG_BLUE
/** Key code constant: App switch key.
* Should bring up the application switcher dialog. */
public static final int KEYCODE_APP_SWITCH
/** Key code constant: Generic Game Pad Button #1.*/
public static final int KEYCODE_BUTTON_1
/** Key code constant: Generic Game Pad Button #2.*/
public static final int KEYCODE_BUTTON_2
/** Key code constant: Generic Game Pad Button #3.*/
public static final int KEYCODE_BUTTON_3
/** Key code constant: Generic Game Pad Button #4.*/
public static final int KEYCODE_BUTTON_4
/** Key code constant: Generic Game Pad Button #5.*/
public static final int KEYCODE_BUTTON_5
/** Key code constant: Generic Game Pad Button #6.*/
public static final int KEYCODE_BUTTON_6
/** Key code constant: Generic Game Pad Button #7.*/
public static final int KEYCODE_BUTTON_7
/** Key code constant: Generic Game Pad Button #8.*/
public static final int KEYCODE_BUTTON_8
/** Key code constant: Generic Game Pad Button #9.*/
public static final int KEYCODE_BUTTON_9
/** Key code constant: Generic Game Pad Button #10.*/
public static final int KEYCODE_BUTTON_10
/** Key code constant: Generic Game Pad Button #11.*/
public static final int KEYCODE_BUTTON_11
/** Key code constant: Generic Game Pad Button #12.*/
public static final int KEYCODE_BUTTON_12
/** Key code constant: Generic Game Pad Button #13.*/
public static final int KEYCODE_BUTTON_13
/** Key code constant: Generic Game Pad Button #14.*/
public static final int KEYCODE_BUTTON_14
/** Key code constant: Generic Game Pad Button #15.*/
public static final int KEYCODE_BUTTON_15
/** Key code constant: Generic Game Pad Button #16.*/
public static final int KEYCODE_BUTTON_16
/** Key code constant: Language Switch key.
* Toggles the current input language such as switching between English and Japanese on
* a QWERTY keyboard.
On some devices, the same function may be performed by
* pressing Shift+Spacebar. */
public static final int KEYCODE_LANGUAGE_SWITCH = 204;
/** Key code constant: Manner Mode key.
* Toggles silent or vibrate mode on and off to make the device behave more politely
* in certain settings such as on a crowded train.
On some devices, the key may only
* operate when long-pressed. */
public static final int KEYCODE_MANNER_MODE
/** Key code constant: 3D Mode key.
* Toggles the display between 2D and 3D mode. */
public static final int KEYCODE_3D_MODE
/** Key code constant: Contacts special function key.
* Used to launch an address book application. */
public static final int KEYCODE_CONTACTS
/** Key code constant: Calendar special function key.
* Used to launch a calendar application. */
public static final int KEYCODE_CALENDAR
/** Key code constant: Music special function key.
* Used to launch a music player application. */
public static final int KEYCODE_MUSIC
/** Key code constant: Calculator special function key.
* Used to launch a calculator application. */
public static final int KEYCODE_CALCULATOR
/** Key code constant: Japanese full-width / half-width key. */
public static final int KEYCODE_ZENKAKU_HANKAKU = 211;
/** Key code constant: Japanese alphanumeric key. */
public static final int KEYCODE_EISU
/** Key code constant: Japanese non-conversion key. */
public static final int KEYCODE_MUHENKAN
/** Key code constant: Japanese conversion key. */
public static final int KEYCODE_HENKAN
/** Key code constant: Japanese katakana / hiragana key. */
public static final int KEYCODE_KATAKANA_HIRAGANA = 215;
/** Key code constant: Japanese Yen key. */
public static final int KEYCODE_YEN
/** Key code constant: Japanese Ro key. */
public static final int KEYCODE_RO
/** Key code constant: Japanese kana key. */
public static final int KEYCODE_KANA
/** Key code constant: Assist key.
* Launches the global assist activity.
Not delivered to applications. */
public static final int KEYCODE_ASSIST
/** Key code constant: Brightness Down key.
* Adjusts the screen brightness down. */
public static final int KEYCODE_BRIGHTNESS_DOWN = 220;
/** Key code constant: Brightness Up key.
* Adjusts the screen brightness up. */
public static final int KEYCODE_BRIGHTNESS_UP
/** Key code constant: Audio Track key
* Switches the audio tracks. */
public static final int KEYCODE_MEDIA_AUDIO_TRACK = 222;
private static final int LAST_KEYCODE
= KEYCODE_MEDIA_AUDIO_TRACK;
红黑联盟&版权所有
Copyright&& 2017
All rights reserved.

我要回帖

更多关于 dispatchkeyevent 的文章

 

随机推荐