踩坑记录(1)-notifyItemRangeChanged
来源:互联网 发布:mac上的翻墙工具 编辑:程序博客网 时间:2024/06/01 13:23
在一个recyclerView 中,设置了滑动删除,和点击删除。点击删除没有问题,而滑动删除会出现显示的问题。
比如顺序的1—-2—-3—-4—-5。
滑动删掉4,再滑动删掉1,结果变为2—-空—-5。
实际3的数据还在,但是不显示,也没法交互。
其中删除的代码如下
//删除一条内容 private void deleteData(int position) { int memoId = memoList.get(position).getId(); DBUtil.deleteMemo(memoId); memoList.remove(position); notifyItemRemoved(position); notifyItemRangeChanged(position, memoList.size()); }
把notifyItemRangeChanged注释掉后,问题就解决了。so werid。
并不知道原因。。
相关的资料
public final void notifyItemRangeChanged (int positionStart, int itemCount)
Notify any registered observers that the itemCount items starting at
position positionStart have changed. Equivalent to calling
notifyItemRangeChanged(position, itemCount, null);.
This is an item change event, not a structural change event. It
indicates that any reflection of the data in the given position range
is out of date and should be updated. The items in the given range
retain the same identity.Parameters
positionStart - -Position of the first item that has changed
itemCount - - Number of items that have changed
- 踩坑记录(1)-notifyItemRangeChanged
- Android RecyclerView批量更新notifyItemRangeChanged
- notifyItemRemoved,notifyItemRangeRemoved和notifyItemRangeChanged(int positionStart, int itemCount, Ob
- [学习记录]Kepware学习记录(1)
- (二)rabbitmq python 踩坑记录
- php踩坑记录(一)
- saiku踩坑记录
- 踩坑记录
- Cocoapods踩坑记录
- 工作踩坑记录
- React踩坑记录
- SSH 踩坑记录
- layui踩坑记录
- 踩坑记录
- websocket踩坑记录
- Kafka 踩坑记录
- vue踩坑记录
- 踩坑记录2
- CI第二篇 集成项目(SVN)workspace编译生成ipa到fir-蒲公英(jenkins)
- 仿OpenStack开发云计算管理软件”--熟悉开发环境
- 南邮编程在线编程题三: 用if语句求解分段函数
- 1、BI概述
- 深入探讨 如何高效找素数
- 踩坑记录(1)-notifyItemRangeChanged
- Google 的开源技术protobuf 简介与例子
- Js数组的操作push,pop,shift,unshift等方法
- 我的第一篇博客
- mavlink解析
- 从一个xib文件中加载另一个xib文件
- 纯代码编写UITableView和UICollectionView中的坑
- 2、BI开发环境
- IOS中获取各个文件的目录路径的方法和NSFileManager类