如果检测到手势,如何发送 KeyEvent
我想要一个手势方向键,但是如果检测到手势,如何发送 e 键事件?例如,我检测到向下的手势,现在我想发送键事件KEYCODE_DPAD_DOWN
。
我怎样才能做到这一点?
I want a gesture D-Pad, but how can I send an e keyevent if I detect a gesture? For example, I detect the gesture down, and now I want to send the keyevent KEYCODE_DPAD_DOWN
.
How can i do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您只想将按键事件发送到您的应用程序,最简单的方法是将其注入到根视图中:
如果您想将其发送到另一个应用程序/窗口,那么您不能(您需要特殊的权限,这需要您需要使用系统证书对您的应用程序进行签名,AFAIK)
If you want to send the key event only to your application, the easiest is to just inject it in the root view:
If you want to send it to another application/window, then you cannot (you would need a special permission, which requires you to have your application signed with the system certificate, AFAIK)