Note that there are some explanatory texts on larger screens.

plurals
  1. POwhat is the best android layout
    primarykey
    data
    text
    <p>I used both RelativeLayout and Linearlayout to achieve this.(in the image)!<img src="https://i.stack.imgur.com/WwDx4.png" alt="enter image description here"></p> <ol> <li><p>Using relative layout, I positioned the buttons with fixed width, and with marginLeft and marginRight. The problem is, if the device has bigger screen, the left, right margins don't expand much, also the button width is fixed. </p> <pre><code> &lt;RelativeLayout&gt; &lt;!-- Row1 --&gt; &lt;Button1 alignParentTop = "true" marginLeft = "5dip" marginRight="5dip" width="80dip"/&gt; &lt;button2 alignParentTop ="true" center="@id/Button1" marginLeft = "5dip" marginRight="5dip" width="80dip" /&gt; &lt;button2 alignParentRight="true" marginLeft = "5dip" marginRight="5dip" width="80dip"/&gt; &lt;!-- Row2 --&gt; &lt;Button3 below="button1" marginLeft = "5dip" marginRight="5dip" width="80dip"/&gt; &lt;Button4 below="button2" marginLeft = "5dip" marginRight="5dip" width="80dip"/&gt; &lt;/RelativeLayout&gt; </code></pre></li> <li><p>Using RelativeLayout parent, created 2 horizontal linearlayout with buttons. Now buttons have 0dip width with weight 1. However, I cannot create the 2nd row.</p></li> </ol> <p><pre><code></p> &lt;RelativeLayout&gt; &lt;linearLayout orientation="horizontal"&gt; &lt;!-- Row1 --&gt; &lt;Button1 width="0dip" weight="1"/&gt; &lt;button2 width="0dip" weight="1"/&gt; &lt;button2 width="0dip" weight="1"/&gt; &lt;/linearLayout&gt; &lt;!--Row2--&gt; &lt;linearLayout orientation="horizontal"&gt; Couldn't using this approach &lt;/linearLayout&gt; &lt;/RelativeLayout&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.
 

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