RecylerView changing single parameter in a row?

雨燕双飞 提交于 2019-12-12 03:36:52

问题


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


回答1:


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) Use placeholder while loading an image

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



来源:https://stackoverflow.com/questions/42605246/recylerview-changing-single-parameter-in-a-row

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!