Android Viewpager加Fragment做界面切换时数据消失的解决方式

 

今天遇到多个Fragment切换,回来后页面空白的情况,找到这个博客方法设置了一下,就可以了


[java] view plain copy
 
  1. vpAdapter = new VpAdapter(getSupportFragmentManager(), fragments);  
  2. vp_content.setAdapter(vpAdapter);  
  3. vp_content.setOffscreenPageLimit(2);//设置ViewPage缓存界面数  
posted @ 2018-06-01 15:55  新感觉  阅读(426)  评论(0编辑  收藏  举报