Search code examples
androidandroid-tablelayout

Spanning columns with TableLayout


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.


Solution

  • 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>