shell@N7000R:/$ input
Usage: input [] [...]
The sources are:
keyboard
mouse
joystick
touchnavigation
touchpad
trackball
dpad
stylus
gamepad
touchscreen
The commands anddefaultsources are:
text(Default: touchscreen)
keyevent [--longpress] ... (Default: keyboard)
tap(Default: touchscreen)
swipe[duration(ms)] (Default: touchscreen)
press (Default: trackball)
roll (Default: trackball)
1、input text
该命令主要是用于向获得焦点的EditText控件输入内容!
adb shell input text "hello,world"
该方法只能对EditText输入AscII码的字符,对于UTF-8的字符是无法输入的!(汉字是不要想用这个命令输入的)
关于某些程序希望实现到类似于按键精灵功能自动向文本框输入汉字的功能,可以使用一个比较取巧的办法。
可以到github上参考https://github.com/senzhk/ADBKeyBoard
2、input keyevent
该命令主要是向系统发送一个按键指令,实现模拟用户在键盘上的按键动作。

本文详细介绍了adb的input命令,包括text、keyevent、tap和swipe等,用于模拟用户在设备上的文本输入、按键操作、点击和滑动。例如,使用`adb shell input text "hello,world"`输入文本,`adb shell input keyevent 4`模拟返回键,`adb shell input tap 100 100`进行点击,以及`adb shell input swipe 100 100 200 200 300`实现滑动操作。"
10525693,1188457,CUDA快速傅里叶变换(cuFFT)详解,"['CUDA编程', 'GPU计算', '性能优化', '异构计算', '快速傅里叶变换']
最低0.47元/天 解锁文章
2338

被折叠的 条评论
为什么被折叠?



