Replies: 3 comments 5 replies
-
我看引入的有viewPager2依赖 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
FragmentStatePagerAdapter已经标注废弃了,所以想试试升级viewPager2配套的FragmentStateAdapter,但是遇到了一些问题。修改位置:RssFavoritesActivity
1、默认offscreenPageLimit值为-1,不预加载;但是不预加载点开某个选项后页面时空白,需要点击一下才会显示;如果打个断点,延缓一下跳转的时间,就没问题了。感觉是数据加载和页面渲染的时机是不是有点问题。
2、offscreenPageLimit设置成1,按理说应该是左右各预加载1个,但是打日志显示CreateFragment调用了好多次,很莫名其妙。
网上没找到相关问题,是写的不对还是viewpager2存在问题啊。有没有试过viewpager2?
Beta Was this translation helpful? Give feedback.
All reactions