【发布时间】:2010-07-25 04:14:03
【问题描述】:
我正在尝试在我的 android 应用程序中使用收音机组/单选按钮的以下示例。 http://www.androidpeople.com/android-radiobutton-example/
但单选按钮位于标签(文本)的左侧。
您能否告诉我如何配置它以使单选按钮位于标签的右侧?并且文本与父级左对齐,单选按钮与父级右侧对齐?
谢谢。
【问题讨论】:
标签: android
我正在尝试在我的 android 应用程序中使用收音机组/单选按钮的以下示例。 http://www.androidpeople.com/android-radiobutton-example/
但单选按钮位于标签(文本)的左侧。
您能否告诉我如何配置它以使单选按钮位于标签的右侧?并且文本与父级左对齐,单选按钮与父级右侧对齐?
谢谢。
【问题讨论】:
标签: android
右侧对齐单选按钮:
<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>
【讨论】:
我做了很详细的回答here。这个问题经常出现,就像我需要仔细格式化 RadioButtons 的情况一样!
祝你好运!
【讨论】: