TableLayout formatting loss after device rotation
- by roundhill
I'm seeing a strange issue with a TableLayout after the device is rotated from either orientation. If you load the view in either portrait or landscape mode, the table loads fine. But once you rotate the device, the columns collapse to just fit their width. I would expect that after rotation, the columns would still stretch to fit the width of the screen. Any ideas on what can be done to resolve this? Screenies and layout code below.
Before Rotation:
After Rotation:
Table Layout:
<TableLayout android:id="@+id/dataTable"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_below="@id/chart"
android:stretchColumns="*"
android:shrinkColumns="*"
android:padding="6dip"
>
</TableLayout>
Table Row:
<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:id="@+id/col1"
android:layout_marginRight="2dip"
android:textColorLink="#FF21759b"
android:text="Column 1"
android:padding="4dip"
android:textColor="#FF464646"/>
<TextView android:id="@+id/col2" android:text="Column 2"
android:textColor="#FF464646"
android:padding="4dip"/>
</TableRow>
Thanks!