ViewPager2+fragment+FragmentStateAdapter

Using viewpager2 with FragmentStateAdapter has a similar behaviour than FragmentStatePagerAdapter

异常 Fragment no longer exists for key

解决方法;

viewpager2.setSaveEnabled(false) 或者
overriding restoreState at our adapter and return null

你可能感兴趣的:(ViewPager2+fragment+FragmentStateAdapter)