-
Notifications
You must be signed in to change notification settings - Fork 779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2019-12-03:谈一谈RecyclerView.Adapter的几种刷新方式有何不同? #202
Comments
为啥都没有人回答我醉了 |
你很棒棒哟~ |
1、notifyDataSetChanged()
2、notifyItemChanged(int position) 前提:一屏幕只显示20条数据,调用notifyItemChanged(0)
3、notifyItemChanged(int position, @nullable Object payload)
5、notifyItemRangeChanged(int positionStart, int itemCount, 前提:一屏幕只显示20条数据,调用notifyItemInserted(1)
总结:不管数据集合是否改变,调用此方法时,都在在指定的位置插入ItemView,从数据集合中的position这个地方拿数据填充 7、notifyItemMoved(int fromPosition, int toPosition) 前提:一屏幕只显示20条数据,调用notifyItemMoved(3,10)
8、notifyItemRangeInserted(int positionStart, int itemCount) 前提:一屏幕只显示20条数据,调用notifyItemRangeInserted(3,10)
9、notifyItemRemoved(int position) 前提:数据集合有50条数据,调用notifyItemRemoved(51)
10、notifyItemRangeRemoved(int positionStart, int itemCount)
payload此参数不知道有何用 |
notifyDataSetChanged 刷新全部可见 |
No description provided.
The text was updated successfully, but these errors were encountered: