I am using ListView and have successfully populated it with the data of a database table using SimpleCursorAdapter .My question is how to add Column names of the database table, to the columns generated in the ListView.
Asked
Active
Viewed 1,543 times
1 Answers
2
You can include your ListView
row layout at the top of your ListView
Element in Xml.
<include layout="@layout/report_row"/>
<ListView
android:id="@+id/YourList"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
>
</ListView>
or you can add a HeaderView
to your list which contains a ViewGroup of your List columns
YourList.addHeaderView(View, null, false);

Arash GM
- 10,316
- 6
- 58
- 76
-
1Very IMPORTANT!: adding header view shifts your list items by 1, meaning that list[0] is now the header view, even though it is sticky. you can have a view separate from your list, and maintain it standalone – Lena Bru Oct 12 '13 at 22:40