dsf11t5u1651 2017-01-31 06:22
浏览 69
已采纳

滚动以为RecyclerView加载更多内容

I have a JSON data which consists of 100 rows. How can I show the first 10 rows when the app is launched and subsequently additional 10 rows when users scroll towards bottom ?

All the solutions that I have found focus more on calling back to the server with the last ID.

What I would like to have is, keep appending the view from the JSON data (100 rows) which is loaded earlier when the app is launched.

Anyone knows how should I go about this ?

  • 写回答

2条回答 默认 最新

  • dougua9328 2017-01-31 06:37
    关注

    What I would like to have is, keep appending the view from the JSON data (100 rows) which is loaded earlier when the app is launched.

    Unless I'm misunderstanding your question. RecyclerView should handle loading of data on its own.

    If your data is already loaded from the server and stored on the phone, then RecyclerView would handle loading of rows, where it would only keep the rows that are shown on the screen in memory and when user scrolls (up or down) and reaches new rows it will load them and show them on the screen and remove the rows that are no longer shown. So just send all of your data (the 100 rows) to your recyclerAdapterand it will handle memory management and loading of rows automatically.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 r语言神经网络自变量重要性分析
  • ¥15 基于双目测规则物体尺寸
  • ¥15 wegame打不开英雄联盟
  • ¥15 公司的电脑,win10系统自带远程协助,访问家里个人电脑,提示出现内部错误,各种常规的设置都已经尝试,感觉公司对此功能进行了限制(我们是集团公司)
  • ¥15 救!ENVI5.6深度学习初始化模型报错怎么办?
  • ¥30 eclipse开启服务后,网页无法打开
  • ¥30 雷达辐射源信号参考模型
  • ¥15 html+css+js如何实现这样子的效果?
  • ¥15 STM32单片机自主设计
  • ¥15 如何在node.js中或者java中给wav格式的音频编码成sil格式呢