[7] ADB 模拟按键/输入
模拟按键/输入
- 电源键
- 菜单键
- HOME 键
- 返回键
- 音量控制
- 媒体控制
- 点亮/熄灭屏幕
- 滑动解锁
- 点击
- 输入文本
在 adb shell
里有个很实用的命令叫input
,通过它可以做一些有趣的事情。
比如使用adb shell input keyevent <keycode>
命令,不同的 keycode 能实现不同的功能,完整的 keycode ,部分如下:
keycode | 含义 |
---|---|
3 |
HOME 键
|
4 |
返回键
|
5 | 打开拨号应用 |
6 | 挂断电话 |
24 | 增加音量 |
25 | 降低音量 |
26 |
电源键
|
27 | 拍照(需要在相机应用里) |
64 | 打开浏览器 |
66 |
回车
|
82 | 菜单键 |
85 | 播放/暂停 |
86 | 停止播放 |
87 | 播放下一首 |
88 | 播放上一首 |
122 | 移动光标到行首或列表顶部 |
123 | 移动光标到行末或列表底部 |
126 | 恢复播放 |
127 | 暂停播放 |
164 | 静音 |
176 | 打开系统设置 |
187 | 切换应用 |
207 | 打开联系人 |
208 | 打开日历 |
209 | 打开音乐 |
210 | 打开计算器 |
220 | 降低屏幕亮度 |
221 | 提高屏幕亮度 |
223 | 系统休眠 |
224 | 点亮屏幕 |
231 | 打开语音助手 |
276 | 如果没有 wakelock 则让系统休眠 |
电源键
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
滑动解锁
如果锁屏没有密码,是通过滑动手势解锁,那么可以通过 input swipe 来解锁。
命令(参数以机型 Nexus 5,向上滑动手势解锁举例):
adb shell input swipe 300 1000 300 500
参数 300 1000 300 500
分别表示起始点x坐标
、起始点y坐标
、结束点x坐标
、结束点y坐标
。
点击
adb shell input tap 50 250
参数50 250
是x,y轴的坐标。
输入文本
在焦点处于某文本框时,可以通过 input 命令来输入文本。
命令:
adb shell input text hello
现在 hello 出现在文本框了。
[7] ADB 模拟按键/输入相关推荐
- adb模拟按键home_ADB——模拟手机按键输入
基本命令 adb 模拟按键输入的命令主要通过 input 进行 Usage: input [] [...] The sources are: mouse keyboard joystick touch ...
- adb 输入回车命令_adb命令模拟按键输入keycode
例子: //这条命令相当于按了设备的Backkey键 adb shell input keyevent 4 //可以解锁屏幕 adb shell input keyevent 82 //在屏幕上做划屏 ...
- linux模拟手柄输入,linux下如何模拟按键输入和模拟鼠标
查看/dev/input/eventX是什么类型的事件, cat /proc/bus/input/devices 设备有着自己特殊的按键键码,我需要将一些标准的按键,比如0-9,X-Z等模拟成标准按键 ...
- 模拟linux设备按键工具,linux下如何模拟按键输入和模拟鼠标
linux下如何模拟按键输入和模拟鼠标 发布时间:2008-08-19 21:11:54来源:红联作者:anopup 查看/dev/input/eventX是什么类型的事件, cat /proc/bu ...
- linux下如何模拟按键输入和模拟鼠标?
转贴请注明出处: blog.csdn.net/chenzhixin 查看/dev/input/eventX是什么类型的事件, cat /proc/bus/input/devices 设备有着自己特殊的 ...
- Linux模拟按键输入
在Linux应用层,可以往/dev/input/event...写入数据来模拟按键输入,程序如下: #include <linux/input.h> #include <sys/ty ...
- adb 模拟键盘输入、点击屏幕、滑动、按键等操作
1. 模拟键盘输入 adb shell input keyboard text "abc" 2. 模拟点击屏幕指定位置 adb shell input tap 500 500 3. ...
- adb 屏幕滑动_安卓通过adb 模拟键盘输入、点击屏幕、滑动、按键
1. 模拟键盘输入 adb shell input keyboard text "abc" 复制代码 2. 模拟点击屏幕指定位置 adb shell input tap 500 5 ...
- adb模拟按键home_adb 命令模拟按键事件 模拟 点击 事件
有时我们需要程序模拟按钮或点击,而手机本身又没有,哪么可以采取adb 模拟实现,最后再去实际设备去测试(前期一般都拿不到设备): 如模拟上一首,下一首,暂停等,手机上是没有的,但有些设备上是有的: / ...
最新文章
- 北大OJ百练——4075:矩阵旋转(C语言)
- 假期宣言2018-01-10
- turtle fillcolor_使Python中的turtle模块画图两只小羊
- Python02期预科课程笔记索引
- 信息学奥赛一本通 1135:配对碱基链 | OpenJudge NOI 1.7 07
- FreeAnchor:令anchor自由匹配标签的策略
- MySQL(12)--- 插入数据
- 为什么android手机内存不够,安卓手机老是内存不足怎么解决
- 提高mysql性能_提升MySQL性能值得借鉴的几个简易方法
- faster rcnn第二阶段loss出现nan_深度学习训练Loss异常Debug思路
- Linux下yum配置及相关问题
- 网课python程序设计答案_中国大学MOOCPython程序设计网课答案
- cadence导入dxf文件_Allegro导入DXF的方法
- MATLAB颜色的植物虫害检测识别
- 如何在图数据库上实现图计算框架
- java中去字符串中的(全角)空格
- 轻流,做未知领域的探索者
- java项目甘特图打印
- chrome浏览器访问https网页提示不是私密连接,点击高级没有继续访问按钮提示
- 如何用Mac自带的QuickTime Player录制视频并制作GIF动图
热门文章
- 云计算已在大数据分析中发挥重要作用
- 中文版microbit:TurnipBit显示动态滚动字符教程实例
- PHP和MySQL Web开发从新手到高手,第7天-创建author管理页面
- shell+html+div+css实现数据库冷备文件检查
- uva 465 - Overflow
- __attribute__编绎属性、关于__init、__initdata、__exit、__exitdata及类似的宏、关于initcall的一些宏定义、__setup宏的来源及使用...
- CryptoHelper HMAC/X509/RSA/TripleDes/Hash/MD5/SHA1 (Release 3)
- 宏锦软件 Android 的 ListView 使用详解
- 从1.5k到18k, 一个程序员的5年成长之路【转载】
- 美国凤凰号探测器从火星土壤中提取到水