2010-07-25 65 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