问题
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