当前位置:网站首页>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
边栏推荐
- Information:2021/9/29 10:01 - Build completed with 1 error and 0 warnings in 11s 30ms Error异常处理
- Abnormal record-11
- 组件化学习
- 组件化学习(2)Arouter原理学习
- iTOP4412 HDMI显示(4.0.3_r1)
- [多屏互动] 实现双多屏异显二:startActivity方式
- error 403 In most cases, you or one of your dependencies are requesting解决
- npm ERR code 500解决
- oracle表的约束详解
- Exception record-6
猜你喜欢
随机推荐
Exception record-6
Error alarm of Postgres master-slave replication delay monitoring
杂七杂八的学习
19C RAC修改VIP及SCANIP步骤-同网段
iTOP4412 HDMI显示(4.0.3_r1)
Exception record-9
RAC环境集群组件gpnp未启动成功问题分析
oracle数据库将多个列的查询结果集合并到一行中
pg库查看某模式下某表的分布键
oracle undo使用率高问题处理
Tiny4412 HDMI display
oracle表的约束详解
Oracle索引状态查询与索引重建
19C环境ORA-01035登陆报错处理
Abnormal record-10
Exception record-7
Abnormal record-11
Exception record-8
OSS云存储管理实践(体验有礼)
Itop4412 HDMI display (4.4.4_r1)