我该如何调整单选按钮相关的文字吧? [英] How can I align radio buttons to the right of associated text?

查看:157
本文介绍了我该如何调整单选按钮相关的文字吧?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我也有类似的按钮单选按钮组内的以下单选按钮。默认情况下一个按钮是在相关文本的左边。我如何获得按钮本身要对相关文本的吧?

 < RadioGroup中
  机器人:ID =@ + ID / points_radio_group
  机器人:layout_width =FILL_PARENT
  机器人:layout_height =WRAP_CONTENT
  机器人:方向=垂直>  <单选
    机器人:ID =@ + ID / do_tastk_1
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT
    安卓:检查=真
    安卓的onClick =doTask1
    机器人:paddingLeft =40dip
    机器人:文字=@字符串/ task_name_1
    机器人:文字颜色=#000000/>  <单选
    机器人:ID =@ + ID / do_tastk_2
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT
    安卓:检查=真
    安卓的onClick =doTask2
    机器人:paddingLeft =40dip
    机器人:文字=@字符串/ task_name_2
    机器人:文字颜色=#000000/>< / RadioGroup中>


解决方案

使用

 安卓按钮=@空
    机器人:drawableRight =@机器人:可绘制/ btn_radio

所以你的code会像

 < RadioGroup中
  机器人:ID =@ + ID / points_radio_group
  机器人:layout_width =FILL_PARENT
  机器人:layout_height =WRAP_CONTENT
  机器人:方向=垂直>  <单选按钮
    机器人:ID =@ + ID / do_tastk_1
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT
    安卓:检查=真
    机器人:按钮=@空
    机器人:drawableRight =@机器人:可绘制/ btn_radio
    安卓的onClick =doTask1
    机器人:paddingLeft =40dip
    机器人:文字=@字符串/ task_name_1
    机器人:文字颜色=#000000/>  <单选按钮
    机器人:ID =@ + ID / do_tastk_2
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT
    安卓:检查=真
    机器人:按钮=@空
    机器人:drawableRight =@机器人:可绘制/ btn_radio
    安卓的onClick =doTask2
    机器人:paddingLeft =40dip
    机器人:文字=@字符串/ task_name_2
    机器人:文字颜色=#000000/>< / RadioGroup中>

I have the following radio buttons inside a radio group of similar buttons. By default a button is on the left of the associated text. How do I get the button itself to be on the right of the associated text?

<RadioGroup
  android:id="@+id/points_radio_group"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:orientation="vertical" >

  <RadioButton
    android:id="@+id/do_tastk_1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:checked="true"
    android:onClick="doTask1"
    android:paddingLeft="40dip"
    android:text="@string/task_name_1"
    android:textColor="#000000" />

  <RadioButton
    android:id="@+id/do_tastk_2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:checked="true"
    android:onClick="doTask2"
    android:paddingLeft="40dip"
    android:text="@string/task_name_2"
    android:textColor="#000000" />

</RadioGroup>

解决方案

use

    android:button="@null"
    android:drawableRight="@android:drawable/btn_radio"

So your code will be like

< RadioGroup
  android:id="@+id/points_radio_group"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:orientation="vertical" >

  < RadioButton
    android:id="@+id/do_tastk_1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:checked="true"
    android:button="@null"
    android:drawableRight="@android:drawable/btn_radio"
    android:onClick="doTask1"
    android:paddingLeft="40dip"
    android:text="@string/task_name_1"
    android:textColor="#000000" />

  < RadioButton
    android:id="@+id/do_tastk_2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:checked="true"
    android:button="@null"
    android:drawableRight="@android:drawable/btn_radio"
    android:onClick="doTask2"
    android:paddingLeft="40dip"
    android:text="@string/task_name_2"
    android:textColor="#000000" />

</RadioGroup>

这篇关于我该如何调整单选按钮相关的文字吧?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆