gpt4 book ai didi

android - 在相对的 android 布局中带有单选按钮的 RadioGroup

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:42:55 26 4
gpt4 key购买 nike

我想创建一个简单的布局,如下所示:

(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),让单选按钮也能工作?非常感谢

最佳答案

你根本做不到。我也曾尝试做类似的事情,但卡住了。

“RadioButton 必须是 RadioGroup 的直接子代。” https://code.google.com/p/android/issues/detail?id=1214

关于android - 在相对的 android 布局中带有单选按钮的 RadioGroup,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3953605/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com