I am trying to make four rows of three buttons each, and at the bottom of the buttons are two text views. I would like for them all to be spaced evenly but they aren\'t and
Ok so to help out with this add android:stretchColumns="0,1,2,3"
in your Table Layout which would make buttons even sized.
Secondly add a android:layout_span="2"
to both of your text views.
Heres you a final code:
<!-- NOTICE STRETCHCOLUMNS ATTRIBUTE-->
<TableLayout android:id="@+id/TableLayout01"
xmlns:android="http://schemas.android.com/apk/res/android"
android:stretchColumns="0,1,2,3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
.
.
.
.
.
<!-- NOTICE LAYOUT_SPAN ATTRIBUTE-->
<TextView android:text="@+id/TextView01"
android:layout_weight="1"
android:id="@+id/TextView01"
android:layout_span="2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></TextView>
<TextView android:text="@+id/TextView02"
android:layout_weight="1"
android:id="@+id/TextView02"
android:layout_span="2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></TextView>
If you are setting the text size programmatically to make your TextViews evenly spaced, its not needed when you have android:layout_span
set.