ViewPager.setOffscreenPageLimit(0) doesn't work as expected

前端 未结 11 989
抹茶落季
抹茶落季 2020-11-22 13:02

The fragments I use in my ViewPager instance are quite resource intensive, so I\'d only like to load one at a time. When I try the following:

mV         


        
11条回答
  •  佛祖请我去吃肉
    2020-11-22 14:00

    for the "instantiateItem" function, just prepare the fragment, but don't load the heavy content.

    Use "onPageChangeListener" , so that each time you go to a specific page, you load its heavy content and show it.

提交回复
热议问题