Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trfiladelfo/f76e73ac5ada0b5118b1c0549f5581a4 to your computer and use it in GitHub Desktop.
Save trfiladelfo/f76e73ac5ada0b5118b1c0549f5581a4 to your computer and use it in GitHub Desktop.
android non swipeable viewpager
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 to switch between pages
return false;
}
@Override
public boolean onTouchEvent(MotionEvent event) {
// Never allow swiping to switch between pages
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment