youlookwhat / ByRecyclerView

🔥 RecyclerView 下拉刷新、上拉松手/自动加载更多、item点击/长按、item局部刷新、头布局/尾布局/状态布局、万能分割线、Skeleton骨架图、极简adapter、嵌套滑动置顶
https://youlookwhat.github.io/ByRecyclerView
Apache License 2.0
798 stars 139 forks source link

上拉加载闪退 #79

Closed CaptainBlackCat closed 4 months ago

CaptainBlackCat commented 4 months ago

使用ByRecycleview先上拉加载,再刷新列表,再次往下滑动会闪退,布局部最外层viewpager里面是CoordinatorLayout+viewpager+ByRecycleview 日志: ViewHolder views must not be attached when created. Ensure that you are not passing 'true' to the attachToRoot parameter of LayoutInflater.inflate(..., boolean attachToRoot)

youlookwhat commented 4 months ago

我还没有遇到这样的情况,我在网上查到这个问题,有可能是缺少 [parent] 导致的。

相同的问题:https://blog.csdn.net/xiayiye5/article/details/113758006

因为我没看到具体的代码,你能不能检查一下有parent的位置看是否传了没有。在addHeader 或 addFooter时候会有这个。

View view = LayoutInflater.from(parent.getContext()).inflate(layoutId, parent, false);
CaptainBlackCat commented 4 months ago

我是用的库里自带的BaseRecyclerAdapter我看源码是用的parent

youlookwhat commented 4 months ago

源码是用的parent,就是看你崩溃的代码,看有没有其他地方,例如加header的时候,要指定View,看那个View有没有加 parent

youlookwhat commented 4 months ago

能提供你那边崩溃的demo代码吗,不能的话我先关闭了,有什么再开了

CaptainBlackCat commented 4 months ago

关了吧,谢了,我换其他实现方式了