1 、問題
viewpage加載第3個fragment的時候,第一個fragment又重新構建問題,感覺自己好傻逼的,不知道啥原因,原來是少了一個設置,加載旁邊多少個fragment不銷毀
2 、解決辦法
viewPager.offscreenPageLimit = 3
3、推薦滑動頁面萬能的指示器框架
https://github.com/hackware1993/MagicIndicator
4、部分代碼實現如下
布局文件
<LinearLayoutandroid:layout_marginTop="@dimen/common_10dp"android:layout_width="match_parent"android:layout_height="match_parent"