Passing touch events to the parent view

后端 未结 9 1195
情书的邮戳
情书的邮戳 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 06:04

    The simplest way to pass child view's TouchEvent to parent view is by adding this to child view:

    @Override
    public boolean onTouchEvent(MotionEvent event) { 
        super.onTouchEvent(event);
        return false;
    }
    

提交回复
热议问题