如何檢測多點觸控事件?該代碼我嘗試是:如何檢測ImageView上的第二根手指觸摸?
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。如何知道是否發生了第二次觸摸?