Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>How does this look?</p> <p><img src="https://i.stack.imgur.com/BRkuw.png" alt="Centered RadioButtons"></p> <p>I used a few invisible RadioButton "spacers". (Code below)</p> <hr> <p>I also tried various combinations with only one "spacer"... (and I switched to the "Light" theme in a quick attempt to mimic your color scheme.)</p> <p><img src="https://i.stack.imgur.com/wzFHz.png" alt="White Centered Buttons"></p> <p>But the top image looks more centered and balanced to me than the bottom one.</p> <hr> <p>This is the code for the top layout. </p> <pre><code>&lt;RadioGroup xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:orientation="horizontal" &gt; &lt;RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:visibility="invisible" /&gt; &lt;RadioButton android:id="@+id/rb_PubAsMe" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:checked="true" android:text="Self" /&gt; &lt;RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:visibility="invisible" /&gt; &lt;RadioButton android:id="@+id/rb_PubAsTeam" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="Team" /&gt; &lt;RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:visibility="invisible" /&gt; &lt;/RadioGroup&gt; </code></pre> <hr> <p>If you prefer the bottom image simply remove the first and last "spacers" and remove the <code>layout_weight</code> attributes. Hope that helps!</p>
 

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