How to add borders in the columns and rows of a TableLayout via code:

0

I created a table, however I need to add rows and columns to the table via code. Does anyone know how I can do this? Thank you in advance.

How do I stay:

    
asked by anonymous 21.01.2016 / 13:15

1 answer

1

Do not have a direct way to do this, you will have to work with background, padding and margins.

below an idea of what you can try to work on.

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

code taken and translated from here

    
21.01.2016 / 13:18