tags:

views:

139

answers:

2

Hi, I couldn't find this question already being asked on this forum. I am little short on time to search anymore.

I have a multi-column ListView with three TextViews. I need to have header for each of the column. I am using Android 1.5 SDK.

Can somebody help me here. I can't use addHeaderView since it adds just one view which would contain just one title string.

Thanks Nayn

A: 

Yes. I have something like this inside every row of my listview

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1?>
<TableRow>
<TextView android:text="Header1"
android:padding="3dip" />
<TextView android:text="Header2"
android:gravity="right"
android:padding="3dip" />
<TextView android:text="Header3"
android:gravity="right"
android:padding="3dip" />
</TableRow>
<TableRow>
<TextView android:text="Data1"
android:padding="3dip" />
<TextView android:text="Data2"
android:padding="3dip" />
<TextView android:text="Data3"
android:padding="3dip" />
</TableRow>
<TableRow>
<TextView android:text="Data1"
android:padding="3dip" />
<TextView android:text="Data2"
android:padding="3dip" />
<TextView android:text="Data3"
android:padding="3dip" />
</TableRow>
</TableLayout>
Jorgesys
I guess having a TableLayout inside *every* row is an overkill. It looks like you have multiple table rows inside every row in listview. What i want is to have single header row above listview but it should look like a column header. The listview is linked to an arraylist via an adapter.
Nayn
A: 

I added a separate table above the list view which has all the columns listed. This solves my problem. Just that data is not aligned properly with the columns. I'll think about it later

Nayn