Kerbol
Kerbol

Reputation: 706

Space between Rows in TableLayout

In my existing code I have three buttons that align themselves horizontally on the same line, however, I would like these buttons to appear on separate lines.

Existing Layout...

[-------] [-------] [-------]

Sought after layout...

[-------]
[-------]
[-------]

    <TableLayout
    android:id="@+id/buttonTableLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:stretchColumns="0,1,2" >

    <TableRow
        android:id="@+id/tableRow0"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >
    </TableRow>

    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >
    </TableRow>

    <TableRow
        android:id="@+id/tableRow2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >
    </TableRow>
</TableLayout>

Upvotes: 1

Views: 629

Answers (1)

Gaeburider
Gaeburider

Reputation: 158

If you want to have one view below the other, the layout-code should be fine! Have you tried to fill it with views? All views in one row will be displayed in one line, so if you want to have 3 seperate lines, you also need 3 rows (which you have done correctly).

Upvotes: 1

Related Questions