In Android I’m trying to use this xml to get a TableLayout next to a LinearLayout. But I can’t get it working. The TableLayout always takes up the full width of the screen. How can I get it to share the screen width with the LinearLayout?
<LinearLayout android:layout_width="fill_parent" android:weightSum="1" android:layout_height="wrap_content" android:orientation="horizontal">
<TableLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.5">
<TableRow>
<TextView android:text="Name1:" />
<TextView android:text="Value1" />
</TableRow>
<TableRow>
<TextView android:text="Name2:" />
<TextView android:text="Value2" />
</TableRow>
</TableLayout>
<LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.5"></LinearLayout>
</LinearLayout>
Like stated above, don’t put the table width as 0dp. I would make the root element a Relative layout then state that the linear layout should be to the right of the table layout.