I am develping a Android Xamarin App. I have to do a complex HTML, I decided to do it whith multiple tables (3)
When I display it, it looks like this.
Here is my script
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TableLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1" >
<TableRow
android:id="@+id/row14"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="0,1" >
<Button
android:text="1"
android:id="@+id/mainmenuBtn"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="7sp" />
<Button
android:text="2"
android:id="@+id/highscoresBtn"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="7sp" />
<Button
android:text="3"
android:id="@+id/playBtn"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="7sp" />
</TableRow>
<TableRow
android:id="@+id/row14"
android:layout_width="match_parent"
android:layout_height="0dip"
android:stretchColumns="0,1" >
<Button
android:text="4"
android:id="@+id/mainmenuBtn"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="7sp" />
<Button
android:text="5"
android:id="@+id/highscoresBtn"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="7sp" />
<Button
android:text="6"
android:id="@+id/playBtn"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="7sp" />
</TableRow>
</TableLayout>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1" >
<TableRow
android:id="@+id/row14"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="0,1" >
<Button
android:text="7"
android:id="@+id/mainmenuBtn"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="7sp" />
<Button
android:text="8"
android:id="@+id/highscoresBtn"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="7sp" />
<Button
android:text="9"
android:id="@+id/playBtn"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="7sp" />
</TableRow>
</TableLayout>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1" >
<TableRow
android:id="@+id/row14"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="0,1" >
<Button
android:text="10"
android:id="@+id/mainmenuBtn"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="7sp" />
<Button
android:text="11"
android:id="@+id/highscoresBtn"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="7sp" />
<Button
android:text="12"
android:id="@+id/playBtn"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="7sp" />
</TableRow>
</TableLayout>
</LinearLayout>
The problem I found is that Each table use 33%, but I need to put one after the other without empty spaces..
Thanks
I you don't want a
LinearLayout
(or a derived class likeTableLayout
) to expand a child, just set its size towrap_content
and don't set a non nulllayout_weight
.So in you case :