Igor Konoplyanko
Igor Konoplyanko

Reputation: 9374

Android: How to make scrollable table with frozen table headers?

I wonder how I could make a scrollable table with static table header ? (with different elements in cells like buttons, images, etc.)

I have already made some of this, but i dont know how to make columns in different tables match each other by width.

<TableLayout>
    <TableRow>
        Table headers...
    </TableRow>
    <ScrollView>
        <TableLayout > <!-- Table content--></TableLayout >
    </ScrollView>
</TableLayout>

Thanks !

Upvotes: 0

Views: 2224

Answers (1)

Nathan Schwermann
Nathan Schwermann

Reputation: 31503

You should ditch the TableLayout for a ListView or GridView Then use a RelativeLayout

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

<LinearLayout
    android:orientation="horizontal"
    android:layout_width="wrap_parent"
    android:laout_height="wrap_content"
    android:alignParentTop="true"
    android:id="@+id/buttons">
 <!-- Your Buttons Here -->
 </LinearLayout>
 <GridView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="@id/buttons"/>
 </RelativeLayout>

Upvotes: 1

Related Questions