[英]how to change position of radio Button in radio group
如何在该按钮中创建一个单选按钮组视图,如水平图所示,我尝试了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>
在您的RadioGroup中,设置:
android:orientation="horizontal"
因为RadioGroup继承自LinearLayout
Android广播组文档提到它继承自Linear Layout 。 搜索“ orientation”会打开android:orientation属性 。
默认为水平。
必须是以下常量值之一。
Constant Value Description horizontal 0 Defines an horizontal widget. vertical 1 Defines a vertical widget.
这对应于全局属性资源符号方向。
因此,只需将此属性添加到Radio Group:
android:orientation="horizontal"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.