Android中设置RadioButton在文字右边的方法实例

这篇文章主要介绍了Android中设置RadioButton在文字右边的方法实例,本文直接给出XML配置实现代码,需要的朋友可以参考下
 

<?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 ,在调用对应的方法将图标放在指定的位置

猜你喜欢

转载自ch-kexin.iteye.com/blog/2317915
今日推荐