简体   繁体   English

回收者视图如何绑定数据?

[英]How recycler view Data bind?

回收者如何一次或一次查看绑定数据?

void onBindViewHolder (VH holder,int position,List<Object> payloads)

Called by RecyclerView to display the data at the specified position. 由RecyclerView调用以在指定位置显示数据。 This method should update the contents of the itemView to reflect the item at the given position. 此方法应更新itemView的内容以反映给定位置的项目。

So one by one. 所以一一。 More here . 这里更多。

Your recycler view calls RecyclerView.Adapter when you set adapter to recycler view or notify dataset changes to the adapter. 将适配器设置为回收站视图或将数据集更改通知给适配器时,您的回收站视图将调用RecyclerView.Adapter。

Recycler view calls OnBindViewHolder for each item in your recycler. 回收器视图针对回收器中的每个项目调用OnBindViewHolder。

Hence, recyclerview binds data one by one. 因此,recyclerview一一绑定数据。 You can clearly see this when you implement animation to the recycler view items. 对回收者视图项目实施动画时,您可以清楚地看到这一点。

RecyclerView is a list drawing library that essentially provides a fixed-size window to load a large dataset into. RecyclerView是一个列表绘图库,它实际上提供了一个固定大小的窗口以将大型数据集加载到其中。 It recycles the views it created at the begining when the views go out of scope (window) and then if there is a need, reuses them to make it seem as if the views were never offloaded and were virtually present outside the window.It binds the rows which are visible to you and recycles the rest 当视图超出范围(窗口)时,它将回收在开始时创建的视图,然后在有需要时重用它们,以使视图似乎从未卸载过并且实际上存在于窗口外部。对您可见的行,并回收其余的行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM