2010-07-25 58 views
3

HI单选按钮,我该如何调整在android系统

我试图在使用无线电组/单选按钮在我的Android应用程序下面的例子。 http://www.androidpeople.com/android-radiobutton-example/

但是单选按钮位于标签(文本)的左侧。

你能告诉我如何配置它,以便单选按钮位于标签的右侧?并且文本与父项左对齐,单选按钮与父项的右对齐?

谢谢。

+0

[更改文本出现在单选按钮上的边]可能的副本(http://stackoverflow.com/questions/2631839/change-the-side-the-text-appears-on-a-radio-button ) – 2011-01-16 16:04:12

回答

3

单选按钮右侧对齐:

<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> 
0

我做了一个非常详细的解答here。这个问题经常弹出,就像我需要仔细格式化RadioButton一样!

祝你好运!

+0

然后你不应该重新回答它,而是将它标记为重复。 – 2015-08-15 11:52:11