使用RecyclerView遇到的一些问题 Inconsistency detected

本文探讨了RecyclerView与ListView的区别,指出RecyclerView在布局管理器尝试获取位置视图时可能出现的不一致性错误。文章引用了谷歌官方讨论中的解释,强调在数据变更时必须确保Adapter与LayoutManager的一致性,避免不恰当的notify事件调用。同时提醒开发者,不推荐在数据更改后立即调用notifyDataSetChanged,而应确保在同一调用堆栈中更新数据并通知RecyclerView。
摘要由CSDN通过智能技术生成
java.lang.IndexOutOfBoundsException: 
Inconsistency detected. Invalid view holder adapter positionViewHolder{
  424b7690 position=7 id=-1, oldPos=8,pLpos:8 scrap tmpDetached no parent} at 
android.support.v7.widget.RecyclerView$Recycler.validat
eViewHolderForOffsetPosition(RecyclerView.java:4349)

以及

java.lang.IndexOutOfBoundsException: 
Inconsistency detected. Invalid item position   157(offset:157).state:588

这个问题在google官方话题单有提到,地址为
ISSUE 77846

其中,项目的pm 有提及如下两点说明:

1.ListView and RecyclerView are different

ListView and RecyclerView are different. RecyclerView is designed to work with different componen

评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值