RecylerView连续更改单个参数? [英] RecylerView changing single parameter in a row?

查看:50
本文介绍了RecylerView连续更改单个参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有RecyclerView,单行包含文本,图像.加载数据后,在一个按钮中单击我想更改文本而无需重新加载该行的图像".我尝试使用notifyItemChanged(position).但这会使图像重新加载.正在使用滑行加载图像,因此当我使用notifyItemChanged(position)时,会发生行闪烁

I have RecyclerView, single row includes text, image. After loading data, in a button click i want to change text without reloading image of the row. I tried using notifyItemChanged(position). But it makes image reloading.. Am using glide for loading images, so when i use notifyItemChanged(position), row flickering occurs

推荐答案

调用notifyItemChanged()
后,整行将重新加载 两种选择:
1)禁用默认的recyclerview项目动画

Whole row will be reloaded once you call notifyItemChanged()
Two options:
1) Disable default recyclerview item animation

ItemAnimator animator = recyclerView.getItemAnimator();
if (animator instanceof SimpleItemAnimator) {
  ((SimpleItemAnimator) animator).setSupportsChangeAnimations(false);
}

2)加载图像时使用占位符

2) Use placeholder while loading an image

查看此 Glide官方链接可以解决以下问题 占位符

Check out this Glide official link to fix the problem with placeholder

这篇关于RecylerView连续更改单个参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆