Skip to content

Instantly share code, notes, and snippets.

@PatrykAndroid
Last active February 18, 2020 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PatrykAndroid/f2fa9d1c57c47447ac8edc56098c784b to your computer and use it in GitHub Desktop.
Save PatrykAndroid/f2fa9d1c57c47447ac8edc56098c784b to your computer and use it in GitHub Desktop.
class PageTransformer : ViewPager2.PageTransformer {
override fun transformPage(page: View, position: Float) {
val offset = position * -(2 * (page.width / 10))
page.translationX = offset
}
}
viewPager2.orientation = ViewPager2.ORIENTATION_HORIZONTAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment