如何在GridLayout中添加Android RadioGroup

如何在GridLayout中添加Android RadioGroup,android,Android,当我尝试将多个单选按钮添加到网格布局中时,它采用了垂直线性布局的行为 这是我的密码 单选组功能正常。(一次只能检查一个单选按钮) 将无线电组的高度和宽度固定到某个特定值可能重复的RadioGroup是LinearLayout的子类。因此,单选按钮s垂直或水平对齐。如果要将它们放在网格中,可以创建一个自定义的GridLayout子类,该子类模仿RadioGroup功能。检查一些解决方案。我已经在那里发帖了。 <GridLayout android:layout_wi

当我尝试将多个单选按钮添加到网格布局中时,它采用了垂直线性布局的行为

这是我的密码

单选组功能正常。(一次只能检查一个单选按钮)



将无线电组的高度和宽度固定到某个特定值可能重复的
RadioGroup
LinearLayout
的子类。因此,
单选按钮
s垂直或水平对齐。如果要将它们放在网格中,可以创建一个自定义的
GridLayout
子类,该子类模仿
RadioGroup
功能。检查一些解决方案。我已经在那里发帖了。
<GridLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/main_linear2"
            android:layout_centerHorizontal="true"
            android:columnCount="3"
            android:rowCount="3"
            android:useDefaultMargins="true">

            <RadioGroup
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">

                <RadioButton
                    android:id="@+id/check_sunday"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="  Sunday" />

                <RadioButton
                    android:id="@+id/check_monday"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Monday" />

                <RadioButton
                    android:id="@+id/check_Tuesday"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Tuesday" />

                <RadioButton
                    android:id="@+id/check_Wednsday"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Wednsday" />

                <RadioButton
                    android:id="@+id/check_Thursday"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Thursday" />

                <RadioButton
                    android:id="@+id/check_Friday"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Friday" />

                <RadioButton
                    android:id="@+id/check_Saturday"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Saturday" />

            </RadioGroup>

        </GridLayout>