移动开发Android Viewpager加Fragment做界面切换时数据消失的解决方式 云博小周宇2024年5月5日2023年8月23日1 Min Read 今天遇到多个Fragment切换,回来后页面空白的情况,找到这个博客方法设置了一下,就可以了 [java] view plain copy vpAdapter = new VpAdapter(getSupportFragmentManager(), fragments); vp_content.setAdapter(vpAdapter); vp_content.setOffscreenPageLimit(2);//设置ViewPage缓存界面数