How to know viewpager is scroll left or right?

前端 未结 13 1977
梦谈多话
梦谈多话 2020-12-13 06:18

I am using ViewPager (support library). I want to know every time the ViewPager change the visible page, it is scrolling left or right.

Please give me a solution. An

13条回答
  •  余生分开走
    2020-12-13 07:19

    Use the ViewPager.OnPageChangeListener interface. You can use the position argument passed to onPageSelected and compare it to the previous value to figure out which way the ViewPager was scrolled.

提交回复
热议问题