Android中未显示多个单选按钮-奇怪的行为

Android中未显示多个单选按钮-奇怪的行为,android,radio-button,Android,Radio Button,对我来说,这是一个非常奇怪的错误。 我用TextView做了类似的事情,一切都像一个符咒,所以我认为它应该也适用于单选按钮 我对android中的单选按钮有问题。当我在一个按钮上设置一个值时,一切都正常。但当我旋转设备时,一些奇怪的事情开始发生 或者这些值没有显示,或者都是相同的值,或者无法单击以前设置的值,并且该值不可见 我确实检查了保存的值,它们正常。 有人能解释一下我做错了什么吗? 多谢各位 代码: xml:Activiti_main <FrameLayout xmlns:andro

对我来说,这是一个非常奇怪的错误。 我用TextView做了类似的事情,一切都像一个符咒,所以我认为它应该也适用于单选按钮

我对android中的单选按钮有问题。当我在一个按钮上设置一个值时,一切都正常。但当我旋转设备时,一些奇怪的事情开始发生

或者这些值没有显示,或者都是相同的值,或者无法单击以前设置的值,并且该值不可见

我确实检查了保存的值,它们正常。 有人能解释一下我做错了什么吗? 多谢各位

代码:

xml:Activiti_main

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
xml:Fragment_main

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<LinearLayout
    android:id="@+id/top_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >


</LinearLayout>

</ScrollView>
xml:组无线电布局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<RadioGroup
        android:id="@+id/aditivs_radio_group"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <RadioButton
            android:id="@+id/radio_alergen_yes_contian"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="yes_contian" />

        <RadioButton
            android:id="@+id/radio_alergen_not_contain"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="not_contain" />
    </RadioGroup>


</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<TextView
    android:id="@+id/alergen_name_title"
    style="?android:listSeparatorTextViewStyle"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingTop="10dp"
    android:text="title" />

</LinearLayout>
xml:无线电布局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<RadioGroup
        android:id="@+id/aditivs_radio_group"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <RadioButton
            android:id="@+id/radio_alergen_yes_contian"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="yes_contian" />

        <RadioButton
            android:id="@+id/radio_alergen_not_contain"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="not_contain" />
    </RadioGroup>


</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<TextView
    android:id="@+id/alergen_name_title"
    style="?android:listSeparatorTextViewStyle"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingTop="10dp"
    android:text="title" />

</LinearLayout>

我确实解决了这个问题,删除了单选按钮的xml文件,并动态显示了它们。 现在所有的逻辑都正常了

的确,我仍然不知道是什么导致了xml的错误。因此,任何解释都将不胜感激