What's better? notifyDataSetChanged or notifyItemChanged in loop?

后端 未结 3 695
耶瑟儿~
耶瑟儿~ 2020-11-29 00:42

So I have an activity with RecyclerView and I want to change TextView of every item in the RecyclerView by pressing button that has

3条回答
  •  天涯浪人
    2020-11-29 01:07

    I've noticed that notifyItemChanged(mPos) triggers onBindVieHolder for corresponding position even it's currently not visible.

    For me, calling it in a loop for all elements was more costly than notifyDatasetChanged which redrawn only visible ones.

    So be careful with large datasets.

提交回复
热议问题