Android Viewpager Only Load One Page One Time
ViewPager.setOffscreenPageLimit(0) doesn't work as expected Like the question. But I need a custom Viewpager which load one page on time. Is there any example?
Solution 1:
Yes you can do this with following steps
- First create a
countvariable in the adapter class - second in the
ViewPagerAdapter make apublicfunction saysetCount() - and in the override
getCount()function of Adapterreturnthecountvariable - now
overridethe onpageScroll()function of theViewPagerwhen the user flips the page you can call thesetCount()to increase thecountof the count variable - also check that if that the current
indexis last and page is scrolled to left
this should work .
Post a Comment for "Android Viewpager Only Load One Page One Time"