I am trying to put titles on a ListView that is generated from a database in android.
In the historyrow.xml
I have
<TextView
android:id="@+id/historyTitle"
android:layout_width="fill_parent"
android:layout_height="20dip"
android:text="Title"/>
<ListView
android:id="@+id/android:list"
android:paddingTop="20dip"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
Which just displays the historyTitle text History. However, If I remove the TextView then the ListView displays correctly with a 20dip padding at the top where I would like the titles to be. Is there a way to get both displayed?
if you are using a
LinearLayoutthen addandroid:orientation="vertical"to theLinearLayouttag and remove the padding from theListViewtag.if you are using a
RelativeLayoutthen addandroid:layout_below=""@id/historyTitle"to theListViewtag and remove the padding from the ListView tag.hope this helps.