使用可滚动视图和视图缓存实现列表视图

Implementing listview with scrollable views and view caching

我正在研究设计一个 ListView 具有水平滚动视图的东西 - 类似于 facebook 应用程序。

我还需要为水平滚动视图实现缓存。

我能想到的一些选项是:

我的方法是什么?

我已经阅读了一些 Whosebug 问题并且仍在研究中,但是 none 我目前阅读的内容还实现了对滚动水平视图的缓存。

This 会帮助你。您可以在滚动时使用缓存。例如,如果您使用水平滚动条加载图像,则可以使用 picasso 库来捕获和加载图像。

只需使用两个嵌套的 RecyclerView。支持数据是二维数组,因为布局是二维的。当调用适配器的 onBindViewHolder 时,外部 RecyclerView 传递内部 RecyclerView 的数据。此外,如果内部视图仅包含一个项目并且不需要水平滚动,您也可以分别使用不同的布局或 ViewHolder

关于实现 RecyclerViews

的一些参考

此处:http://www.bignerdranch.com/blog/recyclerview-part-1-fundamentals-for-listview-experts/

此处:https://developer.android.com/reference/android/support/v7/widget/RecyclerView.html

这里:https://developer.android.com/training/material/lists-cards.html

不要想得太大,我们有一些库可以满足您的需求,下面列出了其中的一些

https://github.com/sephiroth74/HorizontalVariableListView

https://github.com/EmirWeb/parchment

https://github.com/MeetMe/Android-HorizontalListView

我相信这个 link 会对你有所帮助

https://guides.codepath.com/android/Implementing-a-Horizontal-ListView-Guide

https://www.airpair.com/android/horizontal-image-galleries-android-studio