RecyclerView调用notifyDataSetChanged刷新,图片闪烁
来源:互联网 发布:php 微信群发接口 编辑:程序博客网 时间:2024/05/29 08:59
在使用RecyclerView时,当数据更新之后,立即调用notifyDataSetChanged方法进行全局刷新,会导致图片加载闪烁。
解决方法::
1.为adapter提供stableId:
@Override public long getItemId(int position) { return position; }
更简单一点,可以如上代码所示直接return item的position。
2.设置item的setHasStableIds()为true:
adapter.setHasStableIds(true);
在listview中也有复写此方法的方案。
3. 自定义TAG:
Object tag = holder.ivPirture.getTag();if(tag==null || !tag.equals(item.songId)){ holder.ivPirture.setTag(item.songId); Uri uri = Uri.parse(MessageFormat.format(Constants.URL_HEAD, String.valueOf(item.singerId))); holder.ivPirture.setImageURI(uri);}
0 0
- RecyclerView调用notifyDataSetChanged刷新,图片闪烁
- RecyclerView notifyDataSetChanged 图片闪烁的问题
- Imageloader, listview.notifyDataSetChanged刷新问题,图片闪烁
- RecyclerView刷新notifyDataSetChanged
- recyclerview局部刷新闪烁
- android 解决RecyclerView notifyDataSetChanged刷新闪屏问题(图片刷新)
- Android RecyclerView调用notifyDataSetChanged()异常
- ViewPager 调用 notifyDataSetChanged()无刷新
- adapter.notifyDataSetChanged 更新图片闪烁解决办法
- LRecyclerView框架 notifyDataSetChanged 图片闪烁的问题
- RecyclerView调用notifyItemChanged闪烁问题
- Recyclerview调用notifyDataSetChanged()方法无效原因
- Android中RecyclerView调用notifyDataSetChanged方法无效
- RecyclerView notifyDataSetChanged 图片重新加载问题
- 解决RecyclerView中使用UIL加载网络图片,在刷新时出现闪烁问题
- 关于在RecyclerView中使用UniversalImageLoader加载图片刷新数据时引起的闪烁问题
- 解决RecyclerView局部刷新时闪烁
- Android listview图片刷新闪烁
- android studio ndk 开发
- Windows+Python3下绘制Caffe训练日志中的Loss和Accuracy曲线图
- 虚幻4---打造3D人物关卡demo
- web标准
- Servlet从定向和路径匹配
- RecyclerView调用notifyDataSetChanged刷新,图片闪烁
- 例题4-1 古老的密码
- LeetCode 152. Maximum Product Subarray 解题报告
- sql sever数据库学习之-----数据更新与删除
- JS-闭包小解析
- Android开发:顶部&底部Tab导航栏实现(TabLayout+ViewPager+Fragment)
- Hibernate之多对多映射
- Linux运维笔记-文档总结-sort用法和uniq用法
- Problem A: 还会用继承吗?