在Android的ListView中添加标题 [英] Adding Header in ListView in android
本文介绍了在Android的ListView中添加标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在列表视图中添加标题,并且即使滚动列表,标题也应始终显示.
I need add header in my listview and header should always displayed even scrolling list.
在Android列表视图中可以吗?
Is it possible in android list view?
推荐答案
对我有用的解决方案是创建一个TableLayout,该表的标题行和列表行如下:
The solution that works for me is to create a TableLayout that has a row with the heading and a row with the list like this:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/header" />
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</TableLayout>
请确保ListView具有@android:id/list作为ID.
Please make sure that the ListView has @android:id/list as the ID.
这篇关于在Android的ListView中添加标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文