须知:
本文是无需root权限模拟了滑动,点击,长按某点,长按按键,按键事件,如果有你需要的请继续往下看。
1.模拟滑动
input swipe startX startY endX endY duration(ms)
2.单击某点
input tap x y
3.长按某点
input touchscreen swipe x y x y duration(ms)
4.单击某个键
input keyevent keyCode
5.长按某个键
input keyevent --longpress keyCode
如何使用:
例:单击某点
String[] order = {
"input",
"tap",
"" + x,
"" + y
};
Process process = null;
try {
process = new ProcessBuilder(order).start();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (process != null)
ProcessModel.asyncProcessDestroy(process);
}