I use TableLayout with android.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableLayout
android:id="@+id/tableLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:layout_column="1"
android:text="@string/client"
android:width="150px"
style="@style/Infos" />
<TextView
android:id="@+id/client"
android:layout_column="2"
android:width="200px"
style="@style/InfosPrincipale" />
<TextView
android:layout_column="3"
android:text="@string/site"
android:width="150px"
style="@style/Infos" />
<TextView
android:id="@+id/site"
android:layout_column="4"
android:width="200px"
style="@style/InfosPrincipale" />
</TableRow>
....
The result is a table with 4 columns of determined width.
I use a tablet and it’s pretty in portrait mode but not in landscape because it use half of the screen, and I imagine that it would be ugly on phone version.
I have allways the same layout, 2 textview which are linked together. (they must be on the same line)
Is there a layout in Android which permits to show depending the size of the screen 2 or 4 columns ? or is there a way to set a 25% width on each column ? (it would be a good start)
regards
Really, you don’t even need to set the weightSum to 1.
Set each cell layout_weight (sic!) to 25,
each cell layout_width to 0dp (doesn’t work without it!) and
weightSum for the Row to 100.
Even more, you could escape weightSum setting totally, but layout would be more slow.
As for changing the table structure according to orientation, you can do it in code only.
I don’t see what you want to do with your poor columns, but you could change their visibility to GONE and back to VISIBLE. And you’ll see so many as remain visible. But weightSum then should not be set. Or change it together with columns visibility.