語法格式
input [<source>] <command> [<arg>...]
物理鍵
# 電源鍵 adb shell input keyevent 26 # 菜單鍵 adb shell input keyevent 82 # HOME 鍵 adb shell input keyevent 3 # 返回鍵 adb shell input keyevent 4 # 音量+ adb shell input keyevent 24 # 音量- adb shell input keyevent 25 # 靜音 adb shell input keyevent 164
媒體控制
# 播放/暫停 adb shell input keyevent 85 # 停止播放 adb shell input keyevent 86 # 播放下一首 adb shell input keyevent 87 # 播放上一首 adb shell input keyevent 88 # 恢復播放 adb shell input keyevent 126 # 暫停播放 adb shell input keyevent 127
點亮/熄滅屏幕
# 點亮屏幕 adb shell input keyevent 224 # 熄滅屏幕 adb shell input keyevent 223
觸擊屏幕
# x,y為坐標位置
adb shell input tap <X> <Y>
滑動屏幕
四個參數:起始點 x 坐標 起始點 y 坐標 結束點 x 坐標 結束點 y 坐標
# 向上滑動 adb shell input swipe 300 1000 300 500 # 向下滑動 adb shell input swipe 300 100 300 1000 # 向左滑動 adb shell input swipe 1000 500 200 500 # 向右滑動 adb shell input swipe 200 500 1000 500