Android Accessibility perform touch action

心已入冬 提交于 2019-12-06 10:56:39

问题


I am wondering if it is possible to perform touch action with Android accessibility service on screen at position, e.g.:

Bundle arguments = new Bundle();
arguments.putInt(/*coord X*/, /*X value*/);
arguments.putInt(/*coord Y*/, /*Y value*/);
node.performAction(/*touch action*/, arguments);

Or, again if possible, record an action when user taps on a certain view / position.

Basically, I have to perform action over soft keyboard, when it pops up (external app does not have "Submit" button to perform ACTION_CLICK on it), but injecting events is not permitted due to security policies. Any idea? Thanks!


回答1:


You can not perform any action by position on the screen, you can only do on the nodes, but you can find which node is on your coordinates by recursively checking nodes position-on-the-screen with getBoundsInScreen.

It wouldn't work if it is OpenGL game, and you won't be able to perform the click on the precise location only on the node you found on that location.



来源:https://stackoverflow.com/questions/38589790/android-accessibility-perform-touch-action

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!