在一个Fragment中有一个viewpager包含了三个子fragment,其中在包含的第一个子fragment中,也有一个子viewpager,如何让那个子viewpager禁止横向滑动,但是可以通过viewpager.setCurrentItem()来跳转,同时能让子viewpager里面包含的控件能够响应竖直滑动和点击事件。
Inherit the ViewPager class, and override the onTouchEvent and onInterceptTouchEvent methods, directly return false in the method;
Try the method ViewPager.canScrollHorizontally(boolean which). I haven’t tried it. I can’t say whether there is a sliding conflict problem.
If so, you can choose to rewrite onTouchEvent yourself, or give up using ViewPager and switch different fragments to achieve your purpose.
如 @周文超 所说.
传送门:
How do disable paging by swiping with finger in ViewPager but still be able to swipe programmatically?
How to disable or enable viewpager swiping in android
Inherit the ViewPager class, and override the onTouchEvent and onInterceptTouchEvent methods, directly return false in the method;
Try the method ViewPager.canScrollHorizontally(boolean which). I haven’t tried it. I can’t say whether there is a sliding conflict problem.
If so, you can choose to rewrite onTouchEvent yourself, or give up using ViewPager and switch different fragments to achieve your purpose.
如 @周文超 所说.
传送门:
How do disable paging by swiping with finger in ViewPager but still be able to swipe programmatically?
How to disable or enable viewpager swiping in android