开发者

Android MotionEvent.ACTION_MASK

开发者 https://www.devze.com 2023-02-22 05:57 出处:网络
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_DOW

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

精彩评论

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

关注公众号