当前位置:网站首页>RecyclerView上下滑动时,不调用onBindViewHolder 导致列表的item不刷新
RecyclerView上下滑动时,不调用onBindViewHolder 导致列表的item不刷新
2022-08-10 22:16:00 【今人不见古时月,今月曾经照古人】
前一段时间遇到了一个问题,RecyclerView结合Picasso做了一个网络相册功能,上下来回滑动过程中,有一部分item没有调用onBindViewHolder,导致图片没有下载预览,展示空白。
通过代码调试,当 RecyclerView 从上到下滑动,中间不停顿,这个时候是正常的,onBindViewHolder 会调用,不过此时从底部上划的时候,上方的 item 从不可见到可见的这个过程中,部分item 的onBindViewHolder 并没有调用。
参考一些资料,发现时RecyclerView 的缓存复用机制引起的,不缓存就行了。具体代码如下:
myRecyclerView.setItemViewCacheSize(int); //传入-1 就可解决。边栏推荐
猜你喜欢

测试4年感觉和1、2年时没什么不同?这和应届生有什么区别?

瑞幸咖啡第二季营收33亿:门店达7195家 更换CFO

Common interview questions for APP UI automation testing, maybe useful~

Shell编程规范与变量

This visual tool artifact is more intuitive and easy to use!love so much

camera预览流程 --- 从HAL到OEM

GMT,UTC,CST,DST,RTC,NTP,SNTP,NITZ: 嵌入式的时间

【开源教程5】疯壳·开源编队无人机-飞控固件烧写

68:第六章:开发文章服务:1:内容梳理;article表介绍;创建【article】文章服务;

【640. Solving Equations】
随机推荐
3598. Binary tree traversal (Huazhong University of Science and Technology exam questions)
xshell (sed 命令)
Shell编程规范与变量
今日睡眠质量记录75分
win系统下pytorch深度学习环境安装
QT笔记——vs + qt 创建一个带界面的 dll 和 调用带界面的dll
商家招募电商主播要考虑哪些内容
Translating scientific and technological papers, how to translate from Russian to Chinese
JS use regular expressions in g model and non g difference
CIKM2022 | 基于双向Transformers对比学习的序列推荐
C # Hex file transfer skills necessary article 】 【 bin file code implementation
shell脚本
过滤器
水果沙拉酱
特别的三杯鸡
谁是边缘计算服务的采购者?是这六个关键角色
RK3399平台开发系列讲解(内核驱动外设篇)6.35、IAM20680陀螺仪介绍
Service - DNS forward and reverse domain name resolution service
FPGA - Memory Resources of 7 Series FPGA Internal Structure -03- Built-in Error Correction Function
shell (text printing tool awk)