Fragment与ViewPager结合使用的问题
HQLIE2018 opened this issue · 6 comments
HQLIE2018 commented
Fragment与ViewPager结合使用,当滑动到未加载的第二页时,会先出现内容视图,然后才会出现加载的页面,ViewPager调用了setOffscreenPageLimit这个方法,会不会跟调用了这个方法有关?
luckybilly commented
加载中的状态是在调用holder. showLoading();
时显示的,请检查一下你是在何时调用的
HQLIE2018 commented
在setUserVisibleHint这个方法里,当Fragment可见时调用
luckybilly commented
不清楚你的具体业务逻辑,不过作为尝试,你将它提前到onCreateView或者onViewCreated中调用试试
luckybilly commented
HQLIE2018 commented
其实就是ViewPager滑动到下一个Fragment时,在setUserVisibleHint(boolean isVisibleToUser)这个方法里面做了一个懒加载操作
HQLIE2018 commented
大概知道什么原因了,谢谢!