Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>All you need to evenly space an arbitrary number of buttons horizontally across the screen:</p> <ol> <li>RadioGroup has to have <code>android:orientation="horizontal"</code> &amp; <code>android:layout_width="fill_parent"</code></li> <li>Each radio button has to have <code>android:layout_weight="1"</code>, except the rightmost button (to make it line up on the right edge of the screen)!</li> </ol> <p><img src="https://i.stack.imgur.com/0dtUW.png" alt="Landscape screenshot"></p> <p>This took me hours to figure out. </p> <p>Here is some example code, with a bonus of two text labels and the right and left edges of the screen, for a survey app.</p> <pre><code>&lt;RadioGroup android:id="@+id/radio_group" android:orientation="horizontal" android:layout_below="@id/question" android:layout_width="fill_parent" android:layout_height="wrap_content" android:visibility="gone" &gt; &lt;RadioButton android:id="@+id/strong_disagree_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="1" /&gt; &lt;RadioButton android:id="@+id/disagree_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/disagree" /&gt; &lt;RadioButton android:id="@+id/neutral_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/neutral" /&gt; &lt;RadioButton android:id="@+id/agree_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/agree" /&gt; &lt;RadioButton android:id="@+id/strong_agree_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="5" /&gt; &lt;/RadioGroup&gt; &lt;TextView android:id="@+id/disagree_label" android:text="@string/strongly_disagree_txt" android:layout_below="@id/radio_group" style="@style/TextAppearance" android:visibility="gone" /&gt; &lt;TextView android:id="@+id/agree_label" android:text="@string/strongly_agree_txt" android:layout_below="@id/radio_group" android:layout_alignParentRight="true" style="@style/TextAppearance" android:layout_width="wrap_content" android:visibility="gone" /&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.
    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