开发者

How can I align radio button in android

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 wit开发者_C百科h the parent and the radio button is aligned with the right of the parent?

Thank you.


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>


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

Good luck!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜