开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜