当前位置:网站首页>Recyclerview batch update view: notifyitemrangeinserted, notifyitemrangeremoved, notifyitemrangechanged
Recyclerview batch update view: notifyitemrangeinserted, notifyitemrangeremoved, notifyitemrangechanged
2022-04-23 07:10:00 【Zhang Hailong_ China】
If recyclerview Bound data , Suppose the data changes , We are usually :
notifyDataSetChanged perhaps :notifyItemChanged(int position)
But if there's too much data notifyDataSetChanged It will definitely consume some performance , If you update more than one at a time notifyItemChanged() no way , This time we use recyclerview There is a batch update method notifyItemRangeChanged();
Recyclerview Local refresh function of :
Refresh specified from specified location item,notifyItemRangeChanged(int,int);
increase 、 Delete 、 Modified local refresh :
increase :
notifyItemRangeInserted(int startPosition,int itemcount)
startPosition: The starting position , Where to insert data .
itemcount: The number of data .
Delete :
notifyItemRangeRemoved(int startPosition,int itemcount)
Parameters and “ increase ” It's the same , But there is a point of attention :
After calling this method, you need to call all the following data
notifyItemRangeChanged(startPosition,allCount-startPosition);
Otherwise, there will be abnormal position .( The specific reasons will be studied later )
Change :
Direct use notifyItemRangeChanged(int startPosition,int itemcount);
版权声明
本文为[Zhang Hailong_ China]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230607201105.html
边栏推荐
- Cause: dx. jar is missing
- iTOP4412 FramebufferNativeWindow(4.0.3_r1)
- Abnormal record-21
- MySQL笔记5_操作数据
- JS 比较2个数组中不同的元素
- iTOP4412内核反复重启
- Exception record-6
- Error alarm of Postgres master-slave replication delay monitoring
- Using queue to realize stack
- Explore how @ modelandview can forward data and pages through the source code
猜你喜欢
随机推荐
Dolphinscheduler调度sql任务建表时The query did not generate a result set异常解决
org. xml. sax. SAXParseException; lineNumber: 141; columnNumber: 252; cvc-complex-type. 2.4. a: Found element 'B
19C环境ORA-01035登陆报错处理
oracle清除sql的缓存
Oracle和mysql批量查询用户下所有表名和表名注释
项目,怎么打包
窗口分析函数LAST_VALUE,FIRST_VALUE,lag,lead
ARGB透明度换算
Build an OSS based image sharing website - polite feedback
[SM8150][Pixel4]LCD驱动
oracle分区的相关操作
Error alarm of Postgres master-slave replication delay monitoring
Abnormal record-11
mysql和pgsql时间相关操作
Tiny4412 HDMI display
双指针仪表盘读数(一)
MySQL笔记4_主键自增长(auto_increment)
解决:You have 18 unapplied migration(s). Your project may not work properly until you apply
【机器学习】笔记 4、KNN+交叉验证
B站用户视频观看记录的存储方案









