As the developer guide says that table border lines are not displayed there is only a dirty fix for this problem:

Give the TableLayout a background color, give the TableRow another background color and set margin to the TableRow. The amount of the margin is the amount of the “border”. Same for each View in the TableRow.

A “dirty” sample:

1
2
3
4
5
6
7
8
<TableLayout android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:stretchColumns="*" android:background="#ff0000">
    <TableRow android:background="#00ff00" android:layout_margin="2dip">
        <Button android:id="@+id/button" android:text="+" android:background="#0000ff" android:layout_margin="2dip"/>
        <TextView android:text="@string/label"  android:background="#0000ff" android:layout_margin="2dip"/>
        <TextView android:id="@+id/amount"  android:background="#0000ff" android:layout_margin="2dip"/>
    </TableRow>

Source: My answer on anddev.org forum

  • Share/Bookmark