Android 3.0的手指触摸检测手指、Android

2023-09-06 15:00:50 作者:不再与你纠缠

我成功能记录两个手指的坐标被触摸使用以下code中的屏幕上:

I am successfully able to record the coordinates of the two fingers being touched on the screen using the following code:

case MotionEvent.ACTION_MOVE:
Log.d("TOUCH", "test ACTION MOVE" + event.getPointerCount());
Log.d("TOUCH", "test ACTION MOVE ID" + event.getPointerId(0) + " "+event.getPointerId(1));
if(event.getPointerCount()==3)
{

x0 = (int) event.getX(event.getPointerId(0));
y0 = (int) event.getY(event.getPointerId(0));
x1 = (int) event.getX(event.getPointerId(1));
y1 = (int) event.getY(event.getPointerId(1));
x2 = (int) event.getX(event.getPointerId(2));
y2 = (int) event.getY(event.getPointerId(2));

Log.d("TOUCH", "test ACTION DOWN " + " values = " + x0 + " " + y0 + " "
+ x1 + " " + y1+ " "+x2 + " " + y2);
}

但在上述code IM不能够检测到超过2的触摸点的单个实例。即使是pointerCount()永远不会高于2

But In the above code im not able to detect more then 2 touch points at a single instance. Even the pointerCount() never goes above 2.

我怎样才能获得触摸坐标为更多然后2个手指?进出口运行此code在Android 2.2

How can I get the touch coordinates for more then 2 fingers? Im running this code on Android 2.2

推荐答案

这是问前一段时间,但无论如何。答案是,虽然机器人可以跟踪256手指,目前实施限制这2个手指。

This was asked some time ago, but anyway. The answer is that although android could track 256 fingers, the current implementation limits this to 2 fingers.

我不知道蜂巢,但我想它有同样的问题。

I'm not sure about honeycomb, but I guess that it has the same "issue".