Android 如何更改单选按钮在单选组中的位置

Android 如何更改单选按钮在单选组中的位置,android,Android,如何在该按钮中创建单选按钮组视图,如图中的horizontal,我尝试了xml文件,但在该文件中找到了正确的标记。。。。 这是我的xml文件 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertica

如何在该按钮中创建单选按钮组视图,如图中的horizontal,我尝试了xml文件,但在该文件中找到了正确的标记。。。。 这是我的xml文件

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<RadioGroup
    android:id="@+id/radioGroup1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >

    <RadioButton
        android:id="@+id/radio0"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:checked="true"
        android:text="RadioButton" />

    <RadioButton
        android:id="@+id/radio1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="RadioButton" />

    <RadioButton
        android:id="@+id/radio2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="RadioButton" />
</RadioGroup>


在您的放射组中,设置:

android:orientation="horizontal"
因为RadioGroup继承自LinearLayout,所以提到它继承自。搜索“方向”会打开“方向”

默认值为水平

必须是以下常量值之一

Constant      Value   Description
horizontal    0       Defines an horizontal widget.
vertical      1       Defines a vertical widget.
这对应于全局属性资源符号方向

只需将此属性添加到无线组:

android:orientation="horizontal"

你是说微笑?对昨天我回答了一个类似的问题。现在的诀窍是将按钮drawable设置为null(android:button=“@null”)。