Android Table Layout code example

Example: table layout android studio

<TableLayout
        android:id="@+id/table"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginVertical="30dp"
        android:layout_marginHorizontal="10dp"
        android:background="#f1f1f1"
        android:collapseColumns="1,2">

        <TableRow>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Name"
                android:textStyle="bold"
                android:layout_weight="1"
                android:gravity="center"/>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Email"
                android:textStyle="bold"
                android:layout_weight="1"
                android:gravity="center"/>

        </TableRow>
        <TableRow>
           //...
        </TableRow>

    </TableLayout>

Tags:

Misc Example