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
Post a Comment