简体   繁体   English

在recyclerview项目中列出

[英]List in recyclerview item

How to in recycler-view create a list of events dependent on the day, week, month etc? 如何在回收者视图中创建取决于日,周,月等的事件列表? I need a recycler-view with items divided by date and in every single item has some number of events. 我需要一个回收站视图,其中包含按日期划分的项目,并且每个项目中都有一些事件。 But how to create item that will match the number of events? 但是如何创建与事件数量匹配的项目? For example: if I have only one event the item shows only one event, but if there is more item shows more. 例如:如果我只有一个事件,则该项目仅显示一个事件,但是如果有更多项目,则显示更多事件。 Something like the attached picture: enter image description here 类似于所附图片: 在此处输入图片描述

this and this are very good examples to start with. 都是很好的例子开始。 Here is the android documentation 这是android 文档

You can use a Recycler View nested inside another Recycler View. 您可以使用嵌套在另一个“回收器视图”中的“回收器视图”。 The outer adapter will populate items which have different date and inner adapter will populate inner recycler view with number of events in that date. 外部适配器将填充具有不同日期的项目,内部适配器将使用该日期的事件数填充内部回收者视图。 Give it a try. 试试看。 If problem arises, comment. 如果出现问题,请发表评论。

您可以使用嵌套的recyclerview,但是请记住,您可能会遇到一些布局问题。有关recyclerview性能优化的主题很多。

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

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