RecyclerView blinking after notifyDatasetChanged()

前端 未结 18 1752
悲&欢浪女
悲&欢浪女 2020-12-07 16:20

I have a RecyclerView which loads some data from API, includes an image url and some data, and I use networkImageView to lazy load image.

@Override
public vo         


        
18条回答
  •  没有蜡笔的小新
    2020-12-07 16:46

    Try using stable IDs in your RecyclerView.Adapter

    setHasStableIds(true) and override getItemId(int position).

    Without stable IDs, after notifyDataSetChanged(), ViewHolders usually assigned to not to same positions. That was the reason of blinking in my case.

    You can find a good explanation here.

提交回复
热议问题