Possible Duplicate:
What is the equivalent of “colspan” in an Android TableLayout?
It says in the documentation for TableLayout "Cells can span columns, as they can in HTML." However, I can't find any way to do so.
Specifically, I have one row with two columns and another with one column. I want the one column row to span the entire table. Seems easy, but I don't see it.
add android:layout_span="3" to span 3 columns. For example:
        <TableRow>
            <Button android:id="@+id/item_id"
                android:layout_span="2"
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:text="item text" />     
        </TableRow>
                        android:layout_span does the trick.
example:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow>
    <TextView android:id="@+id/info"
        android:layout_span="2"
        android:text="some text"
        android:padding="3dip"
        android:layout_gravity="center_horizontal" />
</TableRow>
<TableRow>
    <TextView android:text="some other text" 
        android:padding="3dip" />
    <TextView android:text="more text" 
        android:padding="3dip" />
</TableRow>
</TableLayout>
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With