Created
March 18, 2018 16:36
-
-
Save kalvian1060/51681a6e0e1ee3878eef553157102e0b to your computer and use it in GitHub Desktop.
Kode ViewPager No Slide
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 root on 08/03/18. | |
*/ | |
public class ViewPagerModif extends ViewPager { | |
private boolean canScroll = true; | |
public ViewPagerModif(Context context) { | |
super(context); | |
} | |
public ViewPagerModif(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
} | |
public void setCanScroll(boolean canScroll) { | |
this.canScroll = canScroll; | |
} | |
@Override | |
public boolean onTouchEvent(MotionEvent ev) { | |
return canScroll && super.onTouchEvent(ev); | |
} | |
@Override | |
public boolean onInterceptTouchEvent(MotionEvent ev) { | |
return canScroll && super.onInterceptTouchEvent(ev); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment