Android多点触摸取得Action和对应的PointerIndex .
- public static int[] GetTouchActionAndPointerIndex(MotionEvent event) {
- int action = event.getAction();
- int ptrIndex = 0;
- if (event.getPointerCount() > 1) {
- int ptrId = (action & MotionEvent.ACTION_POINTER_ID_MASK) >>> MotionEvent.ACTION_POINTER_ID_SHIFT;
- action = action & MotionEvent.ACTION_MASK;
- if (action < 7 && action > 4) {
- action = action - 5;
- }
- ptrIndex = event.findPointerIndex(ptrId);
- }
- return new int[] { action, ptrIndex };
- }