Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
private fun initViewPager() {
val pageAdapter = PageAdapter(listOf(Item(Color.RED), Item(Color.BLUE), Item(Color.GREEN)))
viewPager2.setPageTransformer(PageTransformer())
viewPager2.offscreenPageLimit = 2
viewPager2.orientation = ViewPager2.ORIENTATION_VERTICAL
viewPager2.adapter = pageAdapter
viewPager2.currentItem = pageAdapter.getMiddlePosition()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment