简体   繁体   English

单个活动的两种布局

[英]Two layouts for a single activity

Can i give two layouts for a single activity?? 我可以为一个活动提供两种布局吗? If yes, then how can i join them?? 如果是,那我该如何加入他们? First layout should contain heading and the other one will be used in list adapter and repeated for every item in the list.. 第一个布局应包含标题,而另一个布局将在列表适配器中使用,并对列表中的每个项目重复。

Thanks 谢谢

您可以为“ Activity设置一个布局,并使用以下命令包括一个子布局:

<include android:layout="@layout/layout_name" />

I believe what you want to do is to have an activity layout containing the header and the list view. 我相信您想要做的是拥有一个包含标题和列表视图的活动布局。 And on the other side, a row layout that will be used by a custom adapter for your list view. 另一方面,行布局将由自定义适配器用于列表视图。

Here is a short tutorial covering what you want to acheive: custom-listview-items-and-adapters 这是一个简短的教程,涵盖了您想要实现的目标: custom-listview-items-and-adapters

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

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