Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/211.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Monkeyrunner中使用Android viewClient找出视图的真实坐标?_Android_Jython_Android View_Monkeyrunner_Ui Testing - Fatal编程技术网

如何在Monkeyrunner中使用Android viewClient找出视图的真实坐标?

如何在Monkeyrunner中使用Android viewClient找出视图的真实坐标?,android,jython,android-view,monkeyrunner,ui-testing,Android,Jython,Android View,Monkeyrunner,Ui Testing,在Monkeyrunner中使用dtmilano android vieClient在android UI中查找文本的(x,y)cordinate 我仅使用以下代码获取相对坐标:- vc = ViewClient(devid,deviceid) dump=vc.dump() peer_pos = vc.findViewWithAttribute('text:mText',peer_name) x, y) = peer_pos.getXY() (x,y)的返回并不总是正确的。如何找到真正的坐标。

在Monkeyrunner中使用dtmilano android vieClient在android UI中查找文本的(x,y)cordinate

我仅使用以下代码获取相对坐标:-

vc = ViewClient(devid,deviceid)
dump=vc.dump()
peer_pos = vc.findViewWithAttribute('text:mText',peer_name)
x, y) = peer_pos.getXY()

(x,y)的返回并不总是正确的。如何找到真正的坐标。请有人帮忙。

你看过指南了吗?它介绍了如何将ViewClient与MonkeyRunner结合使用,可能会有所帮助。

我只是从上面的博客中了解到这一点,但是getXY()返回的坐标是相对于其父坐标的,而不是真正的坐标。如果有人能对,遍历到真实坐标。你到底想用坐标做什么。因为如果你试图触摸那个点,看起来你可以做
peer\u pos.touch()
。您可能还希望查看ViewClient的代码,以了解在对象上运行touch方法时它在做什么。为了接触到正确的点,需要使用实际的x,y坐标。