Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think the function you are looking for is android:weightSum. Here is the official reference: <a href="http://developer.android.com/reference/android/widget/LinearLayout.html#attr_android:weightSum" rel="nofollow">http://developer.android.com/reference/android/widget/LinearLayout.html#attr_android:weightSum</a></p> <p>So to expand your table layout to full screen you need to assign a weightSum of 3 to your TableLayout and divide android:layout_weight of 1 to each TableRow. That will give you the desired result.</p> <p>So your xml layout file will look like this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center" android:orientation="vertical" &gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center" android:orientation="horizontal" &gt; &lt;TableLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:weightSum="3" android:gravity="center"&gt; &lt;TableRow android:layout_weight="1"&gt; &lt;Button android:id="@+id/one" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="fill_vertical" android:layout_weight="1" android:gravity="center" android:text="1" /&gt; &lt;Button android:id="@+id/two" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:gravity="center" android:text="2" /&gt; &lt;/TableRow&gt; &lt;TableRow android:layout_weight="1"&gt; &lt;Button android:id="@+id/three" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="fill_vertical" android:layout_weight="1" android:gravity="center" android:text="3" /&gt; &lt;Button android:id="@+id/four" android:text="4" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center" android:layout_weight="1" /&gt; &lt;/TableRow&gt; &lt;TableRow android:layout_weight="1"&gt; &lt;Button android:id="@+id/five" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:gravity="center" android:text="5" /&gt; &lt;Button android:id="@+id/six" android:text="6" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center" android:layout_weight="1" /&gt; &lt;/TableRow&gt; &lt;/TableLayout&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload