是否“ adb shell输入文字”模拟软件键盘输入? [英] Does "adb shell input text" simulate software keyboard input?

查看:170
本文介绍了是否“ adb shell输入文字”模拟软件键盘输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

adb shell input text "sometext"

OR

adb shell input keyevent eventid

这些分别模拟来自虚拟/硬件键盘的实际输入吗?

do these simulate actual input from a virtual/ hardware keyboard respectively ?

我在developer.android.com上找不到这些命令的任何文档/

I did not find any documentation for these commands on developer.android.com/

这些命令是否有任何受信任的文档?

Is there any trusted documentation for these commands?

推荐答案

adb shell输入帮助产生(在一长串输入设备之后):

adb shell input help produces (after a long list of input devices):

The commands and default sources are:
  text <string> (Default: touchscreen)
  keyevent [--longpress] <key code number or name> ... (Default: keyboard)
  tap <x> <y> (Default: touchscreen)
  swipe <x1> <y1> <x2> <y2> [duration(ms)] (Default: touchscreen)
  press (Default: trackball)
  roll <dx> <dy> (Default: trackball)

因此,似乎文字确实是虚拟的(默认值:触摸屏),并且物理按键事件(默认:键盘)。

So it seems "text" is indeed for virtual (Default: touchscreen) and keyevent for physical (Default: keyboard).

您可以覆盖文本输入设备- adb shell输入键盘文本 foo 正常工作。不过,您无法从屏幕上发送原始键码。

You can override the text input device - adb shell input keyboard text "foo" works just fine. You can't send raw keycodes from the screen though.

这篇关于是否“ adb shell输入文字”模拟软件键盘输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆