Back to project page Common-Library.
The source code is released under:
Apache License
If you think the Android project Common-Library listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.morgan.library.widget; /* w w w. j a v a2 s . c o m*/ import android.content.Context; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.MotionEvent; /** * ???????????????????ViewPager * * @author Morgan.Ji * */ public class CustomViewPager extends ViewPager { private boolean scrollAble = true; public CustomViewPager(Context context) { super(context); } public CustomViewPager(Context context, AttributeSet attrs) { super(context, attrs); } @Override public void scrollTo(int x, int y) { if (scrollAble) { super.scrollTo(x, y); } } public boolean isScrollAble() { return scrollAble; } public void setScrollAble(boolean scrollAble) { this.scrollAble = scrollAble; } @Override public boolean onInterceptTouchEvent(MotionEvent arg0) { if (scrollAble) { return super.onInterceptTouchEvent(arg0); } else { return false; } } }