onInterceptTouchEvent only gets ACTION_DOWN

后端 未结 3 1296
暗喜
暗喜 2020-11-29 01:34

Why do ViewGroup\'s only get ACTION_DOWN in the onInterceptTouchEvent? According to the docs, as long as false is returned it should r

3条回答
  •  佛祖请我去吃肉
    2020-11-29 01:51

    [Touch event flow]

    The official doc

    Activity.dispatchTouchEvent(MotionEvent) - This allows your Activity to intercept all touch events before they are dispatched to the window.

    ViewGroup.onInterceptTouchEvent(MotionEvent) - This allows a ViewGroup to watch events as they are dispatched to child Views. It is recursively function (from parent to parent)

    ViewParent.requestDisallowInterceptTouchEvent(boolean) - Call this upon a parent View to indicate that it should not intercept touch events with onInterceptTouchEvent(MotionEvent).

提交回复
热议问题