Passing touch events to the parent view

后端 未结 9 1217
情书的邮戳
情书的邮戳 2020-11-27 05:25

I have a custom ViewSwitcher in which I implemented touch events so I am able to scroll through screens using the touchscreen.

My layout hierarchy looks

9条回答
  •  情歌与酒
    2020-11-27 05:44

    In my parent layout, the only way I have found to prevent the child from capturing the touch event is by overriding onInterceptTouchEvent to return true.

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev)
    {
        return true;
    }
    

提交回复
热议问题