Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. public class CustomViewPager extends ViewPager {
  2.  
  3. private boolean isPageScrollEnabled = true;
  4.  
  5. public CustomViewPager(Context context) {
  6. super(context);
  7. }
  8.  
  9. public CustomViewPager(Context context, AttributeSet attrs) {
  10. super(context, attrs);
  11. }
  12.  
  13. @Override
  14. public boolean onTouchEvent(MotionEvent event) {
  15. return this.isPageScrollEnabled && super.onTouchEvent(event);
  16. }
  17.  
  18. @Override
  19. public boolean onInterceptTouchEvent(MotionEvent event) {
  20. return this.isPageScrollEnabled && super.onInterceptTouchEvent(event);
  21. }
  22.  
  23. public void setPageScrollEnabled(boolean isPageScrollEnabled) {
  24. this.isPageScrollEnabled = isPageScrollEnabled;
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement