So in conclusion of the posts, the right way to do it is to set the NumberOfTheColumns
:
<tablelayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="NumberOfTheColumns"/>
You can set how many horizontal "piece" you need. If you have a 3x3 table:
<TableLayout
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tableLayout1"
android:stretchColumns="3">
<TableRow
android:id="@+id/tableRow1">
<TextView
android:text="@string/EventTitle"
android:id="@+id/textView1"
android:gravity="center_vertical"
android:layout_column="0" />
<EditText
android:inputType="text"
android:id="@+id/editText3"
android:layout_weight="2"
android:layout_span="2"
android:layout_column="1" />
</TableRow>
<TableRow
android:id="@+id/tableRow2">
<TextView
android:text="@string/EventDateStart"
android:id="@+id/textView1"
android:gravity="center_vertical"
android:layout_column="0" />
<EditText
android:inputType="date"
android:id="@+id/editText1"
android:layout_weight="1"
android:layout_column="1"
android:layout_width="wrap_content" />
<EditText
android:inputType="time"
android:id="@+id/editText2"
android:layout_weight="1"
android:layout_column="2"
android:layout_width="match_parent" />
</TableRow>
<TableRow
android:id="@+id/tableRow3">
<TextView
android:text="@string/EventDateEnd"
android:id="@+id/textView1"
android:gravity="center_vertical"
android:layout_column="0"
android:layout_width="match_parent" />
<EditText
android:inputType="date"
android:id="@+id/editText1"
android:layout_weight="1"
android:layout_column="1" />
<EditText
android:inputType="time"
android:id="@+id/editText2"
android:layout_weight="1"
android:layout_column="2" />
</TableRow>
<TableRow>
<TextView
android:text="@string/Description"
android:id="@+id/textView1"
android:gravity="center_vertical"
android:layout_weight="3"
android:layout_span="3"
android:layout_column="0"
android:layout_width="match_parent" />
</TableRow>
<TableRow>
<EditText
android:inputType="textMultiLine"
android:id="@+id/editText3"
android:layout_height="50dp"
android:layout_weight="3"
android:layout_span="3"
android:layout_column="0"
android:layout_width="match_parent" />
</TableRow>
</TableLayout>
In this sample you can see a 5x3 table. You can set each column width by set how many pieces of the full table width do you need...