Tuesday 10 February 2015

Android: TableLayout Round Corners

Create an XML file (name: roundtablecorner.xml) in the drawable folder. Copy the following contents in the file:

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >

    <solid android:color="#006600" />

    <corners android:radius="10dp" />

    <padding
        android:bottom="0dp"
        android:left="0dp"
        android:right="0dp"
        android:top="0dp" />

</shape>

Then use the above (roundtablecorner.xml) file as the background for a TableLayout

    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/roundtablecorner">

Choose the background color in the shape in:

    <solid android:color="#006600" />