Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Use something like the layout below to correctly nest the buttons:</p> <pre><code>&lt;LinearLayout android:orientation="vertical"&gt; &lt;TextView&gt;Put your Text here&lt;/TextView&gt; &lt;LinearLayout android:orientation="horizontal" android:layout_weightSum="2"&gt; &lt;LinearLayout android:orientation="vertical" android:layout_height="fill_parent" android:layout_width="0dp" android:layout_weightSum="3" android:layout_weight="1"&gt; &lt;Button android:layout_weight="1"/&gt; &lt;Button android:layout_weight="1"/&gt; &lt;Button android:layout_weight="1"/&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:orientation="vertical" android:layout_weightSum="3" android:layout_height="fill_parent" android:layout_width="0dp" android:layout_weight="1"&gt; &lt;Button android:layout_weight="1"/&gt; &lt;Button android:layout_weight="1"/&gt; &lt;Button android:layout_weight="1"/&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>Then each button needs height of 0dp (this lets the weight apply and scale the button horizontally) and width of fill parent.</p> <p>The trick is that the weight of a child element will cause the dimension that is set to 0dp to fill to a percentage of of the weightSum of the parent element. </p> <p>Eg i have a linear layout with weightSum 3 and 3 child buttons of weight 1. When height is set to 0dp they will each take 1/3 of the height of the parent as their height. When width is set to 0dp they will each take 1/3 of the width of the parent as their own. </p> <p>This is the best way to organise items according to a percentage width or height.</p> <p>As an aside if you had two buttons one with weight 2 and one with weight 1 then 1 button would be 33% of the parents height/width and the other 66% of the parents height/width. Handy little trick and works on all screens.</p>
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. 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