由网友(默)分享简介:我如何可以检测多点触控事件?在code我尝试是:How can I detect multitouch events? The code im trying is:ImageView im = (ImageView) findViewById(R.id.imageView1);im.setOnTouchListe...
我如何可以检测多点触控事件?在code我尝试是:
How can I detect multitouch events? The code im trying is:
ImageView im = (ImageView) findViewById(R.id.imageView1);
im.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_POINTER_DOWN:
Log.e("case MotionEvent.ACTION_POINTER_DOWN","case MotionEvent.ACTION_POINTER_DOWN");
break;
case MotionEvent.ACTION_DOWN:
Log.e("case MotionEvent.ACTION_DOWN","case MotionEvent.ACTION_DOWN");
break;
case MotionEvent.ACTION_UP:
Log.e("case MotionEvent.ACTION_UP","case MotionEvent.ACTION_UP");
break;
case MotionEvent.ACTION_MOVE:
Log.e("case MotionEvent.ACTION_MOVE","case MotionEvent.ACTION_MOVE");
break;
}
return false;
}
});
有检测第一触摸和在日志猫的输出为MotionEvent.ACTION_POINTER_DOWN。如何知道第二触摸是否发生?
It detects the first touch and the output in the log cat is MotionEvent.ACTION_POINTER_DOWN. How to know whether a second touch has taken place?
推荐答案
有很多方法可以做到这一点,所以你可以选择很多,这里的一些环节有写一个完整的应用程序来处理多点触摸。一个
There are many ways to do it, so u can choose one of many here some link have write a complete application to handle multi touch.
多点触控
多触摸处理
相关推荐
最新文章