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
count
variable in the adapter class - second in the
ViewPager
Adapter make apublic
function saysetCount()
- and in the override
getCount()
function of Adapterreturn
thecount
variable - now
override
the onpageScroll()
function of theViewPager
when the user flips the page you can call thesetCount()
to increase thecount
of the count variable - also check that if that the current
index
is last and page is scrolled to left
this should work .
Post a Comment for "Android Viewpager Only Load One Page One Time"