加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

adb shell input: keyevent,tap,swipe

发布时间:2020-12-15 09:23:33 所属栏目:安全 来源:网络整理
导读:Desc : 模拟事件全部是通过input命令来实现的,首先看一下input命令的使用: usage: input ... input text string input keyevent key code number or name input tap x y input swipe x1 y1 x2 y2 1. keyevent指的是android对应的keycode,比如home键的keyc

Desc :

模拟事件全部是通过input命令来实现的,首先看一下input命令的使用:

usage: input ...

input text <string>
input keyevent <key code number or name>
input tap <x> <y>
input swipe <x1> <y1> <x2> <y2>

1. keyevent指的是android对应的keycode,比如home键的keycode=3,back键的keycode=4.

具体请查阅 <android keycode详解>http://www.52php.cn/article/p-dxnizzde-vo.html

然后使用的话比较简单,比如想模拟home按键:

adb shell input keyevent 3

模拟 按下 Power 键

adb shell input keyevent 26

请查阅上述文章,根据具体keycode编辑即可。

2. 关于tap的话,他模拟的是touch屏幕的事件,只需给出x、y坐标即可。

此x、y坐标对应的是真实的屏幕分辨率,所以要根据具体手机具体看,比如你想点击屏幕(x,y) = (250,250)位置:

adb shell input tap 250 250

3. 关于swipe同tap是一样的,只是他是模拟滑动的事件,给出起点和终点的坐标即可。例如从屏幕(250,250),到屏幕(300,300)即

adb shell input swipe 250 250 300 300

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读