i have this table layout:
<TableRow
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:gravity="center_horizontal">
<TextView
android:id="@+id/TextView01" android:text="test"
android:layout_weight="0.5" android:background="#b0b0b0"
android:textColor="#000000"
android:padding="20dip" android:gravity="left"/>
<TextView
android:id="@+id/TextView04" android:text="Row 3 column 2"
android:layout_weight="0.5" android:background="#a09f9f"
android:textColor="#000000"
android:padding="20dip" android:gravity="left"/>
</TableRow>
I would like to have each column exactly 50 percent of the width.
How can I do it?
Use this construction (layout for one row):
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:weightSum="2" >
<TextView
android:id="@+id/TextView01"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="@+id/TextView04"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</TableRow>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With