如何在安卓中对齐单选按钮

3
我正在尝试在我的安卓应用中使用单选按钮/单选组的以下示例。 http://www.androidpeople.com/android-radiobutton-example/ 但是单选按钮位于标签(文本)的左侧。
请告诉我如何配置它,以使单选按钮位于标签的右侧? 并且文本与父元素左对齐,单选按钮与父元素右对齐?
谢谢。

可能是更改单选按钮上文本出现的位置的重复问题。 - Guido
2个回答

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

我在这里给出了非常详细的答案。这个问题经常出现,我需要仔细地格式化单选按钮!

祝你好运!


那么你不应该重新回答它,而是将其标记为重复。 - Iharob Al Asimi

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接