FragmentPageAdapter和FragmentStatePageAdapter的区别

xiaoxiao2021-02-28  28

使用FragmentPageAdapter适配器的时候,他会持久化数据,即时Fragment被系统销毁,数据也会保存在内存中,所有它不能用来加载大数据量的数据。

使用FragmentStatePageAdapter适配器的时候,他会销毁Fragment仅仅保存Fragment的引用,适合加载大数据量的数据。

public class MyFragmentPageAdapter extends FragmentPagerAdapter{} public class MyFragmentPageAdapter extends FragmentStatePagerAdapter{}只需要修改继承的PageAdapter就可以了。

欢迎关注我的微信公众号:

转载请注明原文地址: https://www.6miu.com/read-2613244.html

最新回复(0)