I’m trying to create a 1×2 TableLayout with MapView in one of the cells.
I’m using the following layout template:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="0,1"
android:padding="5dp">
<TableRow>
<Button android:text="123" />
<com.google.android.maps.MapView
android:id="@+id/mapContainer"
android:apiKey="054E5p80TEOX6y_rf3lKv4rZBPOWv1N2FnYGkjw"
android:clickable="true"/>
</TableRow>
</TableLayout>
As a result i’ve got a table stretched to full width and full height with a little button at the left and a huge map at the right. But i expecting what both button and map will be 50% width. And if i put another button instead of map it works just fine – buttons are drawn with same the width.
Is it a MapView issue or am i doing something wrong?
Why not use a
LinearLayout? ATableLayoutonly makes sense with at least two rows and two columns.Why not use a
LinearLayout? Set both widgets’android:layout_width="0px"andandroid:layout_weight="1".