Reputation: 7723
I have a vertical ViewPager. Each page contains some elements which a NestedScrollView. If I swipe outside of the NestedScrollView it works perfectly, but if I swipe inside the NestedScrollView the vertical scroll of ViewPager doesn't work.
My Nested:
<android.support.v4.widget.NestedScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:clipToPadding="false"
android:overScrollMode="never">
And I set the setup like that too:
scrollView.setNestedScrollingEnabled(false);
Could you help me guys? Thank you very much!
Upvotes: 1
Views: 325
Reputation: 2233
Use requestDisallowInterceptTouchEvent
so it will not allow child to intercept touch events.
yourViewPager.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
yourViewPager.getParent().requestDisallowInterceptTouchEvent(true);
return false;
}
});
For more reference this requestDisallowInterceptTouchEvent
Upvotes: 1