I am developing a screen that uses TableLayout
. Here I am easily able to create two columns. but how can I create three columns ?
Asked
Active
Viewed 1.4k times
2 Answers
18
Here 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>

Yury
- 20,618
- 7
- 58
- 86
-
@Lucifer i think you should upvote to their effort also if you found their answer helpful. – Paresh Mayani Dec 26 '11 at 06:47
-
To have a fixed equal width for all columns, see here: http://stackoverflow.com/a/6647298/261436 – Sam Dec 11 '15 at 21:51
2
For each TableRow you have to add three children instead of two. This should be ok for you!
Hope this helps!

Dimitris Makris
- 5,183
- 2
- 34
- 54