有没有办法有一个单选按钮组被横向布置? [英] Is there a way to have a radio group be laid out horizontally?
本文介绍了有没有办法有一个单选按钮组被横向布置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个单选按钮组内的2个单选按钮。现在他们一字排开垂直。我试图把他们在一个水平容器,但它并没有worck。
I have 2 radio buttons inside a radio group. Right now they are lined up vertically. I tried putting them in a horizontal container, but it did not worck.
有没有办法让按钮的单选按钮组来horizontaly排队?
Is there a way to get a radio group of buttons to line up horizontaly?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioGroup
android:id="@+id/radioSex"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<RadioButton
android:id="@+id/radioChats"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Chats"
android:checked="true" />
</RadioGroup>
<Button android:text="Home"
android:id="@+id/buthome"
android:paddingTop="-15dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button android:text="Players"
android:id="@+id/butplayers"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/viewActivePlayer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TedP"
android:layout_gravity="right"
android:textColor="#fffff109"
android:textSize="26dip" />
推荐答案
添加机器人:方向=横向以RadioGroup中标记:
Add android:orientation='horizontal' to RadioGroup tag:
<RadioGroup
android:id="@+id/radioSex"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation='horizontal'>
这篇关于有没有办法有一个单选按钮组被横向布置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文