简体   繁体   English

如何为这种活动创建布局?

[英]How to create the layout for this kind of activity?

How can I display information in the following format? 如何以以下格式显示信息? What controls should I use, listView or RecycleView? 我应该使用哪些控件(listView或RecycleView)?

Note that the question isn't about this particular activity and how to use it. 请注意,问题不在于此特定活动以及如何使用它。 It's about how to show the information in the same format and how to create the layout for it. 它是关于如何以相同的格式显示信息以及如何为其创建布局的。

在此处输入图片说明

That is a ListView. 那是一个ListView。 You would just need a ListAdapter/ArrayAdapter to fill it and that's about it. 您只需要一个ListAdapter / ArrayAdapter即可填充它,仅此而已。

You can make exactly the same thing using the layout simple_expandable_list_item_2 in the SimpleAdapter of a ListAdapter (here is how you do it : Displaying kind of static data in ListView ) 您可以使用ListAdapterSimpleAdapter中的布局simple_expandable_list_item_2进行完全相同的操作 (这是您的操作方式: 在ListView中显示静态数据的种类

RecyclerView is of course much better in terms of performance and flexibility. 当然,RecyclerView在性能和灵活性方面要好得多。 However, ListView is enough in many cases like this one. 但是,像这样的许多情况下,ListView就足够了。

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

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