Last active
October 9, 2020 16:19
-
-
Save yasukotelin/ae1978683e3a756122cfe6efae925dea to your computer and use it in GitHub Desktop.
This file contains 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
class NoSwipeViewPager(context: Context, attrs: AttributeSet) : ViewPager(context, attrs) { | |
@SuppressLint("ClickableViewAccessibility") | |
override fun onTouchEvent(event: MotionEvent): Boolean { | |
// disable swipe | |
return false | |
} | |
override fun onInterceptTouchEvent(event: MotionEvent): Boolean { | |
// disable swipe | |
return false | |
} | |
override fun setCurrentItem(item: Int, smoothScroll: Boolean) { | |
// disable swipe animation | |
super.setCurrentItem(item, false) | |
} | |
override fun setCurrentItem(item: Int) { | |
// disable swipe animation | |
super.setCurrentItem(item, false) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment