I use this code to listen to event ViewPager scroll:
playingMainViewPager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener { override fun onPageScrollStateChanged(state: Int) { } override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) { } override fun onPageSelected(position: Int) { } })
In onPageScrolled function, positionOffset value move from 0 to 1. So how to use value of positionOffset to create an animation an image move from top to bottom?