I'm using ViewPager2,
newest version 'androidx.viewpager2:viewpager2:1.0.0-beta04'
I have 10 pages and each page is Fragment.
If i set viewpager2.offscreenPageLimit = 1
I have to scroll to page 5 to make the first page destroy.
What happened???, the first page supposed to be destroyed when I scroll to page 3 right??
Then i try the other way to make it right
(viewpager2.getChildAt(0) as RecyclerView).layoutManager?.isItemPrefetchEnabled = false
(viewpager2.getChildAt(0) as RecyclerView).setItemViewCacheSize(1)
This way, the first page will be destroyed when i scroll to page 3, it's working now
Can anyone explain to me the differences between these 2 attributes, please?