简体   繁体   中英

Android: Hide view while scrolling a ViewPager

I have a layout with a ViewPager and also right left arrows inside the ViewPager for manually moving to the next view without swiping. While the user is swiping, I'd like to hide those arrows (or maybe only show the right one when the user is swiping to the right...)

How can I find out if the user is scrolling a ViewPager?

Found the solution:

Method onPageScrollStateChanged from SimpleOnPageChangeListener

http://developer.android.com/reference/android/support/v4/view/ViewPager.SimpleOnPageChangeListener.html#onPageScrollStateChanged(int)

the state argument of onPageScrollStateChanged is 1 when you start draggin, 2 when you let go and 0 when the ViewPager has stopped scrolling

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM