当前位置:网站首页>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 就可解决。
边栏推荐
猜你喜欢
元宇宙社交应用,靠什么吸引用户「为爱发电」?
【640. Solving Equations】
This visual tool artifact is more intuitive and easy to use!love so much
文件IO-缓冲区
camera预览流程 --- 从HAL到OEM
Regular expression of shell programming and text processor
camera preview process --- from HAL to OEM
2021 IDEA creates web projects
Nodes in the linked list are flipped in groups of k
QT笔记——用VS + qt 生成dll 和 调用生成的dll
随机推荐
VLAN huawei 三种模式
华为HCIE云计算之Fusion Access桌面云
美味石井饭菜
交换机和生成树知识点
边缘与云计算:哪种解决方案更适合您的连接设备?
Shell 编程--Sed
Power system power flow calculation (Newton-Raphson method, Gauss-Seidel method, fast decoupling method) (Matlab code implementation)
file IO-buffer
y93.第六章 微服务、服务网格及Envoy实战 -- Envoy配置(四)
电力系统潮流计算(牛顿-拉夫逊法、高斯-赛德尔法、快速解耦法)(Matlab代码实现)
[Maui official version] Create a cross-platform Maui program, as well as the implementation and demonstration of dependency injection and MVVM two-way binding
BM7 链表中环的入口结点
Research on multi-element N-k fault model of power system based on AC power flow (implemented by Matlab code) [Power System Fault]
美味的佳肴
“数据引擎”开启前装规模量产新赛道,「智协慧同」崭露头角
【640. 求解方程】
"DevOps Night Talk" - Pilot - Introduction to CNCF Open Source DevOps Project DevStream - feat. PMC member Hu Tao
艺术与科技的狂欢,阿那亚2022砂之盒沉浸艺术季
shell programming without interaction
68:第六章:开发文章服务:1:内容梳理;article表介绍;创建【article】文章服务;