今天遇到多个Fragment切换,回来后页面空白的情况,找到这个博客方法设置了一下,就可以了
vpAdapter = new VpAdapter(getSupportFragmentManager(), fragments); vp_content.setAdapter(vpAdapter); vp_content.setOffscreenPageLimit(2);//设置ViewPage缓存界面数
原文地址
详细:ViewPager中切换界面Fragment被销毁的问题
ViewPager+Fragment如何控制界面显示时才加载数据