有些时候,需要使用终端模拟点手机的击触摸滑动事件。
手机链接电脑后,在终端上,敲入
adb shell input
即可弹出相应可以操作的命令和方法。
点击menu
adb shell input keyevent 82//(82是menu建)
就相当与手指点击menu了。
adb shell input tap x y //x,y是你想点的屏幕的坐标点。(打开开发者选项,指针位置,即可根据手机上端的xy坐标,即可获知你想点的位置了)
其他的触摸操作等,都有相应的提示
Usage: input [<source>] <command> [<arg>...]
The sources are:
keyboard
mouse
joystick
touchnavigation
touchpad
trackball
dpad
stylus
gamepad
touchscreen
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)