Android : ViewPager block forward on page

on Monday, October 27, 2014


There's a lot of questions and solutions on how to block swipes in an ViewPager.


Example: Control which directions the ViewPager can be scrolled, dynamically with UI feedback


However I would like to only block forward swipe on an specific pages (I have a form and register button that takes next page programatically)


Example: Page 1 -> swipe <- Page 2 -> swipe <- Page 3 (form) -> button -> Page 4


Tried to extend class ViewPager with methods onInterceptTouchEvent and onInterceptTouchEvent but when doing so I can't get the button to work because everything is read as MotionEvent.ACTION_MOVE so don't know when to let the event to go thru or when to use return false;


0 comments:

Post a Comment