How to preload next page and page before in ViewPager2? My app uses list from api in each ViewPager2 tab screen. It is good user experience when next page is loaded before user swipes to it. On old ViewPager it was done automatically
Now it is possible in ViewPager2
Use Version 1.0.0-alpha04
isUserScrollable
attributes are no longer part of SavedStatesaveState
and restoreState
methods made final in FragmentStateAdapterViewPager2.Orientation
and ViewPager2.ScrollState
annotations made non-publicSAMPLE CODE
viewPager2.setOffscreenPageLimit(2);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With