1.模拟滑动屏幕(注意越向上,值越小,以左上角为基准)
a)adb shell input swipe x1 y1 x2 y2
b)解锁adb shell input swipe 100 900 100 100
2.模拟点击屏幕
a)Adb shell input tap x y
b)Adb shell input tap 100 800
3.模拟key值
a) adb shell input keyevent 3 // home
KEYCODE_CALL 拨号键5
KEYCODE_ENDCALL 挂机键6
KEYCODE_HOME 按键Home3
KEYCODE_MENU 菜单键82
KEYCODE_BACK 返回键4
KEYCODE_SEARCH 搜索键84
KEYCODE_CAMERA 拍照键27
KEYCODE_FOCUS 拍照对焦键80
KEYCODE_POWER 电源键26
KEYCODE_NOTIFICATION 通知键83
KEYCODE_MUTE 话筒静音键91
KEYCODE_VOLUME_MUTE 扬声器静音键164
KEYCODE_VOLUME_UP 音量增加键24
KEYCODE_VOLUME_DOWN 音量减小键25
C:\>adb shell input touchscreen --help
Error: Unknown command: --help
Usage: input [<source>] <command> [<arg>...]
The sources are:
mouse
keyboard
joystick
touchnavigation
touchpad
trackball
stylus
dpad
touchscreen
gamepad
The commands and default sources are:
text <string> (Default: touchscreen)
keyevent [--longpress] <key code number or name> ... (Default: keyboard)
tap <x> <y> (Default: touchscreen)
swipe <x1> <y1> <x2> <y2> [duration(ms)] (Default: touchscreen)
press (Default: trackball)
roll <dx> <dy> (Default: trackball)
a)adb shell input swipe x1 y1 x2 y2
b)解锁adb shell input swipe 100 900 100 100
2.模拟点击屏幕
a)Adb shell input tap x y
b)Adb shell input tap 100 800
3.模拟key值
a) adb shell input keyevent 3 // home
KEYCODE_CALL 拨号键5
KEYCODE_ENDCALL 挂机键6
KEYCODE_HOME 按键Home3
KEYCODE_MENU 菜单键82
KEYCODE_BACK 返回键4
KEYCODE_SEARCH 搜索键84
KEYCODE_CAMERA 拍照键27
KEYCODE_FOCUS 拍照对焦键80
KEYCODE_POWER 电源键26
KEYCODE_NOTIFICATION 通知键83
KEYCODE_MUTE 话筒静音键91
KEYCODE_VOLUME_MUTE 扬声器静音键164
KEYCODE_VOLUME_UP 音量增加键24
KEYCODE_VOLUME_DOWN 音量减小键25
C:\>adb shell input touchscreen --help
Error: Unknown command: --help
Usage: input [<source>] <command> [<arg>...]
The sources are:
mouse
keyboard
joystick
touchnavigation
touchpad
trackball
stylus
dpad
touchscreen
gamepad
The commands and default sources are:
text <string> (Default: touchscreen)
keyevent [--longpress] <key code number or name> ... (Default: keyboard)
tap <x> <y> (Default: touchscreen)
swipe <x1> <y1> <x2> <y2> [duration(ms)] (Default: touchscreen)
press (Default: trackball)
roll <dx> <dy> (Default: trackball)