简体   繁体   English

如何将ImageView列表设置为RecyclerView

[英]How to set a list of ImageView into a RecyclerView

I display my JSON data into a RecyclerView. 我将JSON数据显示到RecyclerView中。 I have multiple TextView into one item and it works perfectly. 我将多个TextView集成到一个项目中,并且效果很好。

In my data, I need to fetch photos and display them into each item. 在我的数据中,我需要获取照片并将其显示在每个项目中。 I have multiple photos for one item. 我一项有多张照片。 It starts from 6 photos to... many more. 从6张照片开始,到更多。

I tried using a RecyclerView inside my first RecyclerView but as you can guess it was a bad idea (bad performance, not the good result expected and so on). 我尝试在我的第一个RecyclerView中使用RecyclerView,但是您可以猜到这是一个坏主意(性能差,预期效果不佳,等等)。

Do you have any other solution or advice that might help, please? 您还有其他可能有用的解决方案或建议吗?

I found a thousand solutions how to display one picture by row but none about multiple pictures into one row. 我找到了一千种解决方案,如何逐行显示一张图片,但是却没有将多张图片显示为一行。

Create a custom view and add Image views dynamically based on no.of views required. 创建一个自定义视图,并根据所需的视图数量动态添加图像视图 Use this view in the recycler view adapter itemlayout file. 在回收者视图适配器项目布局文件中使用此视图。

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

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