是否有可能在recyclerview加载项目时仅加载一次并且不重新加载滚动? [英] is it possible that when recyclerview load items just load one time and dont reload scrolling?

查看:731
本文介绍了是否有可能在recyclerview加载项目时仅加载一次并且不重新加载滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能当recyclerview加载项目仅加载一次并且不重新加载滚动时? 我想先加载所有数据,然后再将其加载到我的recyclerView.

is it possible that when recyclerview load items just load one time and dont reload scrolling? I want to load all data before loading it to my recyclerView.

推荐答案

您绝对可以做到这一点.

You can absolutely do that.

  1. (通过Web服务调用或通过任何其他方式)加载所有数据.
  2. 检索到数据后,将它们设置为RecyclerView的适配器并调用notifyDatasetChanged()).
  3. 通常使用RecyclerView(即,将数据对象绑定到onBindViewHolder()中的视图.
  1. Load all the data (through a web service call or by any other means).
  2. When data are retrieved, set them to the RecyclerView's adapter and call notifyDatasetChanged()).
  3. Use the RecyclerView normally (i.e. binding data objects to the views in onBindViewHolder().

这样,您将获得所需的内容(拥有所有数据,并且无需在用户滚动时加载更多内容),以及RecyclerView的优点,它可以创建所需数量的视图.

This way you will get what you want (having all data and not needing to load more as the user scrolls) and the benefits of the RecyclerView, that creates as many views as needed.

这篇关于是否有可能在recyclerview加载项目时仅加载一次并且不重新加载滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆