参考资料
StaggeredGridLayoutManager报错IndexOutOfBoundsException
stackoverflow
bugly崩溃信息
bugly解决方案
使用viewpager+4个fragment
每个fragment中为swiperefreshlayout+recyclervie
出现上述错误,最终错误原因不在StaggeredGridLayoutManager,而是viewpager的状态保存
解决方法:
viewpager.setOffscreenPageLimit(list.size() - 1);
作者:龙猫跑跑跑
链接:https://www.jianshu.com/p/7896f33e94fa
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
If your RecyclerView is in a Fragment and your Fragment is in ViewPager, and you didn't set viewpager.setOffscreenPageLimit(MAX_ITEM_SIZE), this crash will some times happen unexpectedl
I was suffering same crashes. I can't reproduce it, and don't know why it would happen till now. But after I set the off-screen page limit, this crash goes away.
Wish it helps.
网友评论