【发布时间】:2011-04-26 14:23:13
【问题描述】:
我想创建一个简单的布局,如下所示:
(o) Radio button A
(o) Radio button B [textedit]
[x] checkbox
为此,我创建了以下 layout.xml:
<RadioGroup
android:layout_above="@+id/RadioButton_Count"
android:id="@+id/RadioGroup01"
android:layout_height="wrap_content"
android:layout_width="fill_parent">
<RadioButton
android:layout_height="wrap_content"
android:id="@+id/RadioButton_A"
android:text="Play forever"
android:checked="true"
android:layout_width="fill_parent"
android:textSize="20sp">
</RadioButton>
<RelativeLayout
android:id="@+id/RelativeLayout01"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/RadioButton_B"
android:text="Count:"
android:textSize="20sp">
</RadioButton>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/EditText_NumCount"
android:inputType="number"
android:layout_toRightOf="@+id/RadioButton_B"
android:width="70sp" >
</EditText>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/CheckBox_StopCount"
android:text="Stop"
android:layout_below="@+id/RadioButton_B"
android:textSize="18sp">
</CheckBox>
</RelativeLayout>
</RadioGroup>
看起来不错,但问题是单选按钮之间没有连接,我的意思是它们可以同时打开。 我认为这是因为即使它们挂在同一个布局中,第二个也在另一个布局中:\ 有谁知道我怎样才能制作这种布局(主要是 [textedit] 就在 RadioButton B 的右边),同时使单选按钮也能正常工作? 非常感谢
【问题讨论】:
标签: android user-interface layout radio-button