This article was reproduced from: http://blog.sina.com.cn/s/blog_68f262210102vc1b.html
Transferred from: http://blog.csdn.net/jlminghui/article/details/39268419
Example:
ADB shell input KeyEvent 4 #这条命令相当于按了设备的Backkey键
ADB shell input KeyEvent #可以解锁屏幕
Each number corresponds to the KeyCode table as follows:
0--"keycode_unknown"
1--"Keycode_menu"
2--"Keycode_soft_right"
3--"Keycode_home"
4--"Keycode_back"
5--"Keycode_call"
6--"Keycode_endcall"
7--"Keycode_0"
8--"Keycode_1"
9--"keycode_2"
Ten--"Keycode_3"
---"keycode_4"
---"keycode_5"
---"keycode_6"
---"keycode_7"
---"keycode_8"
---"keycode_9"
---"Keycode_star"
---"Keycode_pound"
--"keycode_dpad_up"
---"Keycode_dpad_down"
--"Keycode_dpad_left"
---"keycode_dpad_right"
--"Keycode_dpad_center"
---"keycode_volume_up"
---"Keycode_volume_down"
---"keycode_power"
---"Keycode_camera"
---"keycode_clear"
--"keycode_a"
---"Keycode_b"
---"Keycode_c"
---"keycode_d"
---"keycode_e"
---"Keycode_f"
--"Keycode_g"
---"Keycode_h"
---"keycode_i"
---"Keycode_j"
"Keycode_k"
---"keycode_l"
---"keycode_m"
--"Keycode_n"
---"keycode_o"
---"keycode_p"
---"keycode_q"
---"Keycode_r"
---"keycode_s"
---"keycode_t"
---"Keycode_u"
"Keycode_v"
Wuyi--"Keycode_w"
---"keycode_x"
---"keycode_y"
---"keycode_z"
---"Keycode_comma"
---"keycode_period"
---"Keycode_alt_left"
---"keycode_alt_right"
---"Keycode_shift_left"
"Keycode_shift_right"
---"Keycode_tab"
---"keycode_space"
---"Keycode_sym"
---"keycode_explorer"
"Keycode_envelope"
---"Keycode_enter"
---"Keycode_del"
---"Keycode_grave"
---"Keycode_minus"
---"keycode_equals"
---"Keycode_left_bracket"
---"Keycode_right_bracket"
---"Keycode_backslash"
---"Keycode_semicolon"
---"Keycode_apostrophe"
---"Keycode_slash"
---"keycode_at"
---"Keycode_num"
---"Keycode_headsethook"
---"Keycode_focus"
Bayi--"Keycode_plus"
----"Keycode_menu"
---"keycode_notification"
---"Keycode_search"
---"Tag_last_keycode"
keycode ListPhone key
|
Keycode_call |
Dialing keys |
5 |
Keycode_endcall |
Hanging machine Key |
6 |
Keycode_home |
Button Home |
3 |
Keycode_menu |
Menu key |
82 |
Keycode_back |
Return key |
4 |
Keycode_search |
Search Key |
84 |
Keycode_camera |
Photo Key |
27 |
Keycode_focus |
Taking pictures of Zoom |
80 |
Keycode_power |
Power key |
26 |
Keycode_notification |
Notification key |
83 |
Keycode_mute |
Microphone Mute Key |
91 |
Keycode_volume_mute |
Speaker Mute Key |
164 |
Keycode_volume_up |
Volume Increase key |
24 |
Keycode_volume_down |
Volume Decrease key |
25 |
|
Keycode_num |
Key number modifier |
Keycode_info |
Key Info |
Keycode_app_switch |
Button App Switch |
Keycode_bookmark |
Key Bookmark |
Keycode_avr_input |
Key A/V Receiver input |
Keycode_avr_power |
Button A/V Receiver power |
Keycode_captions |
Key Toggle Captions |
Keycode_channel_down |
Key channel down |
Keycode_channel_up |
Key channel up |
Keycode_clear |
Button Clear |
Keycode_dvr |
Key DVR |
Keycode_envelope |
Key Envelope Special function |
Keycode_explorer |
Key Explorer Special function |
Keycode_forward |
Key forward |
Keycode_forward_del |
Key forward Delete |
Keycode_function |
Key function modifier |
Keycode_guide |
Key Guide |
Keycode_headsethook |
Button Headset Hook |
Keycode_meta_left |
Press the left Meta modifier |
Keycode_meta_right |
button right Meta modifier |
Keycode_pictsymbols |
Button picture Symbols modifier |
Keycode_prog_blue |
Key Blue "Programmable" |
Keycode_prog_green |
Button Green "programmable" |
Keycode_prog_red |
Key Red "programmable" |
Keycode_prog_yellow |
Key yellow "programmable" |
Keycode_settings |
Key settings |
Keycode_soft_left |
Press Soft left |
Keycode_soft_right |
Button Soft Right |
Keycode_stb_input |
Key Set-top-box Input |
Keycode_stb_power |
Key Set-top-box Power |
Keycode_switch_charset |
Button Switch Charset modifier |
Keycode_sym |
Key symbol modifier |
Keycode_sysrq |
Button System Request/print screen |
Keycode_tv |
Key TV |
Keycode_tv_input |
Key TV Input |
Keycode_tv_power |
Key TV Power |
Keycode_window |
Key window |
Keycode_unknown |
Unknown key |
Control keys
|
Keycode_enter |
Enter |
66 |
Keycode_escape |
ESC key |
111 |
Keycode_dpad_center |
Navigation key OK key |
23 |
Keycode_dpad_up |
Navigation key Up |
19 |
Keycode_dpad_down |
Navigation key Down |
20 |
Keycode_dpad_left |
Navigation key left |
21st |
Keycode_dpad_right |
Navigation keys to the right |
22 |
Keycode_move_home |
Cursor moves to the Start key |
122 |
Keycode_move_end |
Cursor moves to the END key |
123 |
Keycode_page_up |
Page UP key |
92 |
Keycode_page_down |
Page DOWN key |
93 |
Keycode_del |
Backspace key |
67 |
Keycode_forward_del |
Delete key |
112 |
Keycode_insert |
Insert key |
124 |
Keycode_tab |
TAB key |
61 |
Keycode_num_lock |
Keypad lock |
143 |
Keycode_caps_lock |
Caps LOCK key |
115 |
Keycode_break |
Break/pause Key |
121 |
Keycode_scroll_lock |
Scroll LOCK key |
116 |
Keycode_zoom_in |
Magnification key |
168 |
Keycode_zoom_out |
Zoom Out Key |
169 |
Key combinations
|
Keycode_alt_left |
Alt+left |
Keycode_alt_right |
Alt+right |
Keycode_ctrl_left |
Control+left |
Keycode_ctrl_right |
Control+right |
Keycode_shift_left |
Shift+left |
Keycode_shift_right |
Shift+right |
Basic
|
Keycode_0 |
Key ' 0 ' |
7 |
Keycode_1 |
Key ' 1 ' |
8 |
Keycode_2 |
Key ' 2 ' |
9 |
Keycode_3 |
Key ' 3 ' |
10 |
Keycode_4 |
Key ' 4 ' |
11 |
Keycode_5 |
Key ' 5 ' |
12 |
Keycode_6 |
Key ' 6 ' |
13 |
Keycode_7 |
Key ' 7 ' |
14 |
Keycode_8 |
Key ' 8 ' |
15 |
Keycode_9 |
Key ' 9 ' |
16 |
Keycode_a |
Key ' A ' |
29 |
Keycode_b |
Key ' B ' |
30 |
Keycode_c |
Key ' C ' |
31 |
Keycode_d |
Key ' D ' |
32 |
Keycode_e |
Key ' E ' |
33 |
Keycode_f |
Key ' F ' |
34 |
Keycode_g |
Key ' G ' |
35 |
Keycode_h |
Key ' H ' |
36 |
Keycode_i |
Key ' I ' |
37 |
Keycode_j |
Key ' J ' |
38 |
Keycode_k |
Key ' K ' |
39 |
Keycode_l |
Key ' L ' |
40 |
Keycode_m |
Key ' M ' |
41 |
Keycode_n |
Press ' N ' |
42 |
Keycode_o |
Key ' O ' |
43 |
Keycode_p |
Key ' P ' |
44 |
Keycode_q |
Key ' Q ' |
45 |
Keycode_r |
Key ' R ' |
46 |
keycode_s |
Press ' S ' |
47 |
keycode_t |
Button ' T ' |
48 |
Keycode_u |
Press ' U ' |
49 |
Keycode_v |
Press ' V ' |
50 |
Keycode_w |
Press the key ' W ' |
51 |
Keycode_x |
Key ' X ' |
52 |
Keycode_y |
Press ' Y ' |
53 |
Keycode_z |
Key ' Z ' |
54 |
Symbol
|
Keycode_plus |
Press ' + ' |
Keycode_minus |
Button '-' |
Keycode_star |
Button ' * ' |
Keycode_slash |
Button '/' |
Keycode_equals |
Key ' = ' |
Keycode_at |
Press the key ' @ ' |
Keycode_pound |
Key ' # ' |
Keycode_apostrophe |
Key "(single quote) |
Keycode_backslash |
Button ' \ ' |
Keycode_comma |
Button ', ' |
Keycode_period |
Press the button '. ' |
Keycode_left_bracket |
Button ' [' |
Keycode_right_bracket |
Button '] ' |
Keycode_semicolon |
Button '; ' |
Keycode_grave |
Button "" |
Keycode_space |
Space key |
Small keyboard
|
Keycode_numpad_0 |
Keypad key ' 0 ' |
Keycode_numpad_1 |
Keypad key ' 1 ' |
Keycode_numpad_2 |
Keypad key ' 2 ' |
Keycode_numpad_3 |
Keypad key ' 3 ' |
Keycode_numpad_4 |
Keypad key ' 4 ' |
Keycode_numpad_5 |
Keypad key ' 5 ' |
Keycode_numpad_6 |
Keypad key ' 6 ' |
Keycode_numpad_7 |
Keypad key ' 7 ' |
Keycode_numpad_8 |
Keypad key ' 8 ' |
Keycode_numpad_9 |
Keypad key ' 9 ' |
Keycode_numpad_add |
keypad Keys ' + ' |
Keycode_numpad_subtract |
keypad Keys '-' |
Keycode_numpad_multiply |
keypad Keys ' * ' |
Keycode_numpad_divide |
keypad Keys '/' |
Keycode_numpad_equals |
Keypad key ' = ' |
Keycode_numpad_comma |
keypad Keys ', ' |
Keycode_numpad_dot |
Keypad key '. ' |
Keycode_numpad_left_paren |
keypad Keys ' (' |
Keycode_numpad_right_paren |
Keypad key ') ' |
Keycode_numpad_enter |
keypad keys Enter |
function keys
|
Keycode_f1 |
Key F1 |
Keycode_f2 |
Key F2 |
Keycode_f3 |
Key F3 |
Keycode_f4 |
Key F4 |
Keycode_f5 |
Key F5 |
Keycode_f6 |
Key F6 |
Keycode_f7 |
Key F7 |
Keycode_f8 |
Key F8 |
Keycode_f9 |
Key F9 |
Keycode_f10 |
Key F10 |
Keycode_f11 |
Key F11 |
Keycode_f12 |
Key F12 |
Multimedia keys
|
Keycode_media_play |
Multimedia key Playback |
Keycode_media_stop |
Multimedia Key Stop |
Keycode_media_pause |
Multimedia Key Pause |
Keycode_media_play_pause |
Multimedia key play/Pause |
Keycode_media_fast_forward |
Multimedia Key Fast Forward |
Keycode_media_rewind |
Multimedia Key Fast Rewind |
Keycode_media_next |
Multimedia key Next |
Keycode_media_previous |
Multimedia key on a song |
Keycode_media_close |
Multimedia key off |
Keycode_media_eject |
Multimedia Key Popup |
Keycode_media_record |
Multimedia Key Recording |
Handle button
|
Keycode_button_1 |
Universal Game handle Button # # |
Keycode_button_2 |
Universal GamePad Button #2 |
Keycode_button_3 |
Universal GamePad Button #3 |
Keycode_button_4 |
Universal GamePad Button #4 |
Keycode_button_5 |
Universal GamePad Button #5 |
Keycode_button_6 |
Universal GamePad Button #6 |
Keycode_button_7 |
Universal GamePad Button #7 |
Keycode_button_8 |
Universal GamePad Button #8 |
Keycode_button_9 |
Universal GamePad Button #9 |
Keycode_button_10 |
Universal GamePad Button #10 |
Keycode_button_11 |
Universal GamePad Button #11 |
Keycode_button_12 |
Universal GamePad Button #12 |
Keycode_button_13 |
Universal GamePad Button #13 |
Keycode_button_14 |
Universal GamePad Button #14 |
Keycode_button_15 |
Universal GamePad Button #15 |
Keycode_button_16 |
Universal GamePad Button #16 |
Keycode_button_a |
Game Handle Button A |
Keycode_button_b |
Game Handle Button B |
Keycode_button_c |
Game Handle Button C |
Keycode_button_x |
Game Handle Button X |
Keycode_button_y |
Game Handle Button Y |
Keycode_button_z |
Game Handle Button Z |
Keycode_button_l1 |
Game Handle Button L1 |
Keycode_button_l2 |
Game Handle Button L2 |
Keycode_button_r1 |
Game Handle Button R1 |
Keycode_button_r2 |
Game Handle Button R2 |
Keycode_button_mode |
Game Handle Button Mode |
Keycode_button_select |
Game Handle Button Select |
Keycode_button_start |
Game Handle Button Start |
Keycode_button_thumbl |
Left Thumb Button |
Keycode_button_thumbr |
Right Thumb Button |
ADB command simulates key event "go"