How to create three columns in TableLayout

I am developing a screen that uses TableLayout . Here I can easily create two columns. but how can i create three columns?

+8
android layout
source share
2 answers

Here is an example:

 <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:stretchColumns="1"> <TableRow> <TextView android:text="first" android:padding="3dip" /> <TextView android:text="second" android:gravity="center" android:padding="3dip" /> <TextView android:text="third" android:gravity="right" android:padding="3dip" /> </TableRow> <TableRow> <TextView android:text="first" android:padding="3dip" /> <TextView android:text="second" android:gravity="center" android:padding="3dip" /> <TextView android:text="third" android:gravity="right" android:padding="3dip" /> </TableRow> </TableLayout> 
+14
source share

For each TableRow, you need to add three children instead of two. That should be good for you!

Hope this helps!

+2
source share

All Articles