3

I am trying the following example in using the radio group/radio button in my android application. http://www.androidpeople.com/android-radiobutton-example/

But the radio button is on the left side of the label (text).

Can you please tell me how can I configure it so that the radio button is on the right side of the label? and text is left-aligned with the parent and the radio button is aligned with the right of the parent?

Thank you.

Samet ÖZTOPRAK
  • 3,112
  • 3
  • 32
  • 33
michael
  • 106,540
  • 116
  • 246
  • 346
  • possible duplicate of [Change the side the text appears on a radio button](http://stackoverflow.com/questions/2631839/change-the-side-the-text-appears-on-a-radio-button) – Guido Jan 16 '11 at 16:04

2 Answers2

3

Radio Button for right side align:

<RadioButton
                    android:id="@+id/radio0"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:background="@null"
                    android:button="@null"
                    android:checked="true"
                    android:drawableRight="@drawable/presets_sel"
                    android:padding="12dp"
                    android:text="RadioButton 1" />
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/right_arrow_h" android:state_checked="true"/>
    <item android:drawable="@drawable/right_arrow_h" android:state_pressed="true"/>
    <item android:drawable="@drawable/right_arrow"></item>

</selector>
Ramesh Akula
  • 5,720
  • 4
  • 43
  • 67
0

I made a very detailed answer here. This question pops up often, as does situations where I need to carefully format RadioButtons!

Good luck!

Community
  • 1
  • 1
SMBiggs
  • 11,034
  • 6
  • 68
  • 83