Text leftside of a RadioButton with a margin on Android
You can achieve this by setting android:button="@null"
and adding the drawable of the RadioButton
as android:drawableRight
. You can change the Padding between the text and the drawable with android:drawablePadding
.
<RadioGroup
android:id="@+id/radios"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:inputType="text"
android:orientation="vertical" >
<RadioButton
android:id="@+id/first"
android:button="@null"
android:drawableRight="@android:drawable/btn_radio"
android:drawablePadding="20dp"
android:layout_width="200dip"
android:layout_height="wrap_content"
android:text="@string/first"
android:textSize="20dip" />
<RadioButton
android:id="@+id/second"
android:button="@null"
android:drawableRight="@android:drawable/btn_radio"
android:drawablePadding="20dp"
android:layout_width="200dip"
android:layout_height="wrap_content"
android:text="@string/second"
android:textSize="20dip" />
</RadioGroup>
</RelativeLayout>