android - ViewPager without swipe and pass the swipe to parent TabLayout -


i have nested viewpager in fragment. , want manually switch fragment inside viewpager. managed successfully.

i disable swipe doing this.

public class nonswipeableviewpager extends viewpager {      public nonswipeableviewpager(context context) {         super(context);     }      public nonswipeableviewpager(context context, attributeset attrs) {         super(context, attrs);     }      @override     public boolean onintercepttouchevent(motionevent event) {         // never allow swiping switch between pages         return false;     }      @override     public boolean ontouchevent(motionevent event) {         // never allow swiping switch between pages         return false;     } } 

the problem when this. disable swipe of parent tabs.

any idea?

remove overrides onintercepttouchevent() , ontouchevent() , use instead:

@override public boolean canscrollhorizontally(int direction) {     return false; } 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -