BaseRecyclerViewAdapterHelper Called attach on a child which is not detached: BaseViewHolder

ebdffaop  于 22天前  发布在  其他
关注(0)|答案(3)|浏览(38)

version:3.0.7
Fatal Exception: java.lang.IllegalArgumentException
Called attach on a child which is not detached: BaseViewHolder{de9678c position=1 id=-1, oldPos=-1, pLpos:-1 not recyclable(1)} androidx.recyclerview.widget.RecyclerView{

rur96b6h

rur96b6h1#

有人提供一下帮助吗 help!

idv4meu8

idv4meu82#

recyclerView系统bug默认动画导致的,去掉默认动画就可以了

pvcm50d1

pvcm50d13#

或许新版已经修复,但用旧版懒得升级的,就需要注意下使用方式。

在添加了 header 的情况下,notify item 时,其位置应该是:

notifyItemChanged(index + headerLayoutCount)
其中 index 为需要更新的条目位置, headerLayoutCount 是可以在 adapter 中直接获取到的一个方法,写法为 kotlin 所以显示看着是变量。

相关问题