是否可以在Android中模拟屏幕上的点击? [英] Is it possible to simulate a click on the screen in Android?

查看:560
本文介绍了是否可以在Android中模拟屏幕上的点击?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过坐标或在视图元素上模拟点击(触摸屏)?

Is it possible to simulate a "click" (touch screen) by coordinates or on a view element?

推荐答案

它可以在android屏幕上模拟触摸事件。如果您具有视图的坐标,则可以使用adb shell命令生成触摸事件。例如,对于

It is possible to simulate touch events on android screen. If you have the coordinates of the view then you can generate touch events by using adb shell commands. For e.g-

adb shell输入水龙头x y

adb shell input tap x y

其中x和y是您的坐标。您可以从终端运行此命令。如果要从android代码运行命令,请使用 / system / bin / input tap x y并使用Runtime.getRuntime()方法运行它。详情请回复,乐于帮助! :)

where x and y are your coordinates. You can run this command from terminal. If you want to run the command from android code then use "/system/bin/ input tap x y" and run this by using Runtime.getRuntime() method. For details please reply, happy to help! :)

这篇关于是否可以在Android中模拟屏幕上的点击?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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