Android设置RadioButton在文字的右边



 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" 
    android:layout_marginRight="5dp"
    android:layout_marginLeft="10dp">

    <RadioGroup
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <RadioButton
            android:id="@+id/rb_disable"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:button="@null"
            android:drawableRight="@android:drawable/btn_radio"
            android:text="@string/data_romaing_disable" />

        <RadioButton
            android:id="@+id/rb_national_romaing_only"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:button="@null"
            android:drawableRight="@android:drawable/btn_radio"
            android:text="@string/data_romaing_national_romaing_only" />

        <RadioButton
            android:id="@+id/rb_all_network"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:button="@null"
            android:drawableRight="@android:drawable/btn_radio"
            android:text="@string/data_romaing_all_network" />
    </RadioGroup>

</LinearLayout>

 想要改变RadioButton 的位置,就先设置默认的图片为null ,在调用对应的方法将图标放在指定的位置

猜你喜欢

转载自862123204-qq-com.iteye.com/blog/2029258