Android的MotionEvent.ACTION_MASK [英] Android MotionEvent.ACTION_MASK
问题描述
在OnTouchEvent,如果通过与不同的触摸操作切换
In OnTouchEvent, if you switch through different touch actions with
开关(e.getAction),它处理ACTION_DOWN和ACTION_MOVE,但出于某种原因没有赶上ACTION_POINTER_DOWN,而如果你做
开关(e.getAction&安培; MotionEvent.ACTION_MASK),它可以处理多点触摸以及。有谁知道原因,为什么出现这种情况?
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?
推荐答案
由于为指针事件指针的指数或者是涨跌互现恩在动作中codeD。只要使用MotionEvent.getActionMasked()和MotionEvent.getActionIndex()(或做掩蔽自己),不要担心。
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.
这篇关于Android的MotionEvent.ACTION_MASK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!