Created
December 4, 2014 08:00
-
-
Save amyu/f80c521a71c3cc90d96b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.content.Context; | |
| import android.support.v4.view.ViewPager; | |
| import android.util.AttributeSet; | |
| import android.view.MotionEvent; | |
| /** | |
| * Created by amyu on 2014/12/4. | |
| */ | |
| public class NoSwipeViewPager extends ViewPager { | |
| private boolean mIsSwipe = false; | |
| public NoSwipeViewPager(Context context) { | |
| super(context); | |
| } | |
| public NoSwipeViewPager(Context context, AttributeSet attrs) { | |
| super(context, attrs); | |
| } | |
| public void setSwipe(boolean flag) { | |
| mIsSwipe = flag; | |
| } | |
| @Override | |
| public boolean onTouchEvent(MotionEvent event) { | |
| return mIsSwipe && super.onTouchEvent(event); | |
| } | |
| @Override | |
| public boolean onInterceptTouchEvent(MotionEvent event) { | |
| return mIsSwipe && super.onInterceptTouchEvent(event); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment