how to disable viewpager adapter on touching specific views?

前端 未结 4 1396
长发绾君心
长发绾君心 2020-12-01 02:59

I have a viewpager which switches between tabs when swiping left/right.In my second tab, i have some custom views which have listeners for pinching and dragging but when i t

4条回答
  •  孤街浪徒
    2020-12-01 03:37

    If you know the positions on which you don't want to intercept touch events in the view pager you can do something like I did.

     @Override
     public boolean onInterceptTouchEvent(MotionEvent arg0) {
        if(arg0.getY()>getHeight()/2)return false;
        return super.onInterceptTouchEvent(arg0);
    }
    

提交回复
热议问题