用到ViewPager和TabLayout时,发现FragmentPagerAdapter()方法过时
class MyAdapter(fm: FragmentManager?, fragmentList: List<Fragment>):
FragmentPagerAdapter(fm!!){
.......
解决办法:
class MyAdapter(fm: FragmentManager?, fragmentList: List<Fragment>):
FragmentPagerAdapter(fm!!, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT){
......