Android MotionEvent.ACTION_MASK
In OnTouchEvent, if you switch thro开发者_Go百科ugh different touch actions with
switch (e.getAction), it handles ACTION_DOWN and ACTION_MOVE, but it for some reason doesn't catch ACTION_POINTER_DOWN, whereas if you do switch (e.getAction & MotionEvent.ACTION_MASK), it handles multi touch as well. Does anyone know the reason as to why this is the case?
Because for pointer events the index of the pointer that went up or down is encoded in the action. Just use MotionEvent.getActionMasked() and MotionEvent.getActionIndex() (or do the masking yourself) and don't worry about it.
精彩评论