我已经使用本教程来执行可扩展列表视图。 http://www.androidhive.info/2013/07/android-expandable-list-view-tutorial/。 但我想做一个小改动,如下图所示。我不知道用红色加下划线的项目。是否可以在可扩展列表视图中包含列?
.xml文件
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#f4f4f4"
android:orientation="vertical" >
<ExpandableListView
android:id="@+id/lvExp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:cacheColorHint="#00000000" />
</LinearLayout>
任何人都可以帮助我。任何帮助将不胜感激。
答案 0 :(得分:1)
您需要两个布局:可扩展标头和子项。在您的示例中,它们是list_item
和group_item
。
编辑它们并添加其余字段。
如果对字段宽度使用权重,则可以将标题和行设置为网格。
简言之:
对于标题(group_layout
),请使用包含四个TextView的LinearLayout(以权重2,1,1,1开头,并根据测试进行调整)。
对于行(list_item
),请使用包含以下内容的RelativeLayout:
below
。查看RelativeLayout参数以设置您的视图。