如何获得在Android的双触摸位置? [英] How to get double touch position in android?
本文介绍了如何获得在Android的双触摸位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要让每一个接触的位置时,双触摸做了 我知道,你可以得到一个触摸的位置上:
I need to get the positions of each touch when a double touch has done I know that you can get the position of one touch with:
int x = (int)event.getX();
int y = (int)event.getY();
我怎样才能得到第二个X和Y?
how can I get a second x and y?
推荐答案
event.getPointerCount()会告诉你有多少个触摸点也有。 为了得到其他的人,只需要使用一个索引值获取的方法:
event.getPointerCount() will tell you how many touch points there are. To get the other ones, just use an index value in the "Get" method:
X0 = event.getX(0);
X1 = event.getX(1);
......
x0 = event.getX(0);
x1 = event.getX(1);
...
这篇关于如何获得在Android的双触摸位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文