Reputation: 1245
I am using ViewPager inside my Navigation Drawer and am encountering an issue when I want to swipe to next tab in ViewPager. Swiping works in direction which opens Navigation Drawer but doesn't work in direction which closes Navigation drawer.
That means I can normally swipe to ViewPager pages to "right" direction but when I want to swipe to the "left", NavigationDrawer intercepts touch events and closes itself.
I would still like to have ability for navigation drawer to close if user swipes on content which doesn't have horizontal scroll. How can I accomplish something like this? Thank you.
Upvotes: 3
Views: 951
Reputation: 10869
use View.requestDisallowInterceptTouchEvent(true);
when you do not want your ViewPager
to close, call this View.requestDisallowInterceptTouchEvent(false);
immediately after Action_Up.
What it does is it prevents the parent from listening or intercepting the touch event.
Upvotes: 3