用命令行发送键盘,touch消息

本文介绍如何使用sendevent命令在安卓模拟器上模拟各种按键事件,包括菜单键、主页键和其他键盘按键。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

use: sendevent

 command format: sendevent

 device type code value
[command]     [device]             [type]    [code]   [value]
 sendevent
 /dev/input/event0    1          229      1
/dev/input/event0 is the device to send it to
[type] 1 is unknow for me ( maybe code for physical button on device )
[code] 229 is the MENU button of the emulator
[value] 1 is keydown or press down ( for keyup or up use 0 )
i wrote a batch file for sending the event to the device like below:
adb -s emulator-5554 shell sendevent
 /dev/input/event0 1 229 1
adb -s emulator-5554 shell sendevent /dev/input/event0 1 229 0
have to use the follow command to simulate a pressing of button ( aka pressing down then let go )

Key Name                 CODE
MENU                       229
HOME                       102
BACK (back button)    158
CALL (call button)       231
END (end call button)  107
now keyboard shown on the emulator
Key Name                 CODE
1                               2
2                               3
3                               4
4                               5
5                               6
6                               7
7                               8
8                               9
9                               10
0                               11
q                               16
w                               17
e                               18
r                                19
t                                20
y                               21
u                               22
i                                23
o                               24
p                               25
a                               30
s                               31
d                               32
f                                33
g                               34
h                               35
j                                36
k                               37 l                                38
DEL (delete key)        14
SHIFT (shift key)        42
z                               44
x                               45
c                               46
v                               47
b                               48
n                               49
m                              50 . (period)                    52 return (enter key)        28
Lt Alt (Left ALT key)    56 SYM                         127 @                             215 Spc (Space key)        57 /                               53

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值