正如标题所描述的那样,我正在尝试将一个3x3单选按钮网格组合成一个单一的无线电组.在之前的一个问题中,我了解到,对于与单个组相对应的单选按钮,他们必须是他们将对应的无线电组的直接子项.当我试图在一个广播组中封装整个表格布局(在表行中使用单选按钮)时,我学到了很多.
跑进那堵墙,我尝试了以下几点:
<TableLayout android:id="@+id/table_radButtons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/title_radGroup_buffer">
<TableRow>
<RadioGroup android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/radGroup1">
<RadioButton android:id="@+id/rad1"
android:text="Button1"
android:layout_width="105px"
android:layout_height="wrap_content"
android:textSize="13px"></RadioButton>
<RadioButton android:id="@+id/rad2"
android:text="Button2"
android:layout_width="105px"
android:textSize="13px"
android:layout_height="wrap_content"></RadioButton>
<RadioButton android:id="@+id/rad3"
android:text="Button3"
android:layout_width="105px"
android:textSize="13px"
android:layout_height="wrap_content"></RadioButton>
</RadioGroup>
</TableRow>
<TableRow>
<RadioGroup android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/radGroup1">
<!-- snippet -->
</TableRow>
<!-- snippet --->
</TableLayout>
Run Code Online (Sandbox Code Playgroud)
显然我第一次没有学习,因为我再次遇到了一堵墙.我希望不同表行中的单选按钮会注意到它们是同一个无线电组的一部分(给每个组提供相同的ID),但这不起作用.
有没有什么方法可以将所有这些按钮分组到一个单独的无线电组中并仍然保持我的3x3结构(每行3行,3个单选按钮)?
我有一个RadioGroup,我想将两个列和五行中的按钮对齐,我无法实现它.我尝试过的事情:
RelativeLayout- >外RadioGroup- >里面RadioGroup.所有RadioButtons都被选中,但我只想选择一个.RadioGroup :方向TableRowTableLayout请让我知道如何创建一个RadioGroup并且有两列和多列RadioButtons.