I want to use tables in my applications design however unlike HTML in Android's XML layouts you are unable to set the width of something using a percent. From looking on Google it seems like I can use "layout_weight" for the same functionality as long as the values add up to 100.With information from this question(http://stackoverflow.com/questions/3629331/android-trying-to-understand-androidlayout-weight) I wrote my layout and it seemed to work fine.
Here is what it looks like & the XML file: https://i.stack.imgur.com/QwkcA.png
<?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="fill_parent"
android:layout_height="fill_parent">
<TableRow
android:id="@+id/tablerow1"
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="10">
</TableRow>
<TableRow
android:id="@+id/tablerow2"
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="80">
</TableRow>
<TableRow
android:id="@+id/tablerow3"
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="10">
<TableRow
android:id="@+id/tablerow4"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="50">
</TableRow>
<TableRow
android:id="@+id/tablerow5"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="50">
</TableRow>
</TableRow>
</TableLayout>
</LinearLayout>
However when I add buttons to this layout it breaks as seen here: https://i.stack.imgur.com/95jEn.png
<?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="fill_parent"
android:layout_height="fill_parent">
<TableRow
android:id="@+id/tablerow1"
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="10">
</TableRow>
<TableRow
android:id="@+id/tablerow2"
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="80">
</TableRow>
<TableRow
android:id="@+id/tablerow3"
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="10">
<TableRow
android:id="@+id/tablerow4"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="50">
<Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Speak">
</Button>
</TableRow>
<TableRow
android:id="@+id/tablerow5"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="50">
<Button
android:id="@+id/button2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Listen">
</Button>
</TableRow>
</TableRow>
</TableLayout>
</LinearLayout>
Can anyone explain to me why this is? I simply want three rows at 10%, 80%, and 10%, and then two taking up 50% of the width of the final row.