Here is the XML code for the button part for my table row in a table layout:
<TableRow
android:id="@+id/tableRow8"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="@+id/buttonclear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Clear"
android:layout_weight="1" android:textSize="18sp"/>
<Button
android:id="@+id/buttonback"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Back"
android:layout_weight="1" android:textSize="18sp"/>
<Button
android:id="@+id/buttonconfirm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Confirm"
android:layout_weight="1" android:textSize="18sp"/>
</TableRow>
Without inputting constants dip, how could I divide those button evenly into three?
I got no luck in experimenting with the weight though.
You may want to use the
android:stretchColumnsattribute on the TableLayout. As it is zero-based attribute, it should get the value “0,1,2” in your case.So your XML should probably look as follows:
Hope it helps.