问题
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