PreferenceScreen get "ScrollView can host only one direct child" after returning on

Viewed 138

I get this error and I do not understand why ...

E/AndroidRuntime: FATAL EXCEPTION: main
                  java.lang.IllegalStateException: ScrollView can host only one direct child
                      at android.widget.ScrollView.addView(ScrollView.java:261)
                      at android.support.design.widget.BaseTransientBottomBar.showView(BaseTransientBottomBar.java:444)
                      at android.support.design.widget.BaseTransientBottomBar$1.handleMessage(BaseTransientBottomBar.java:185)
                      at android.os.Handler.dispatchMessage(Handler.java:101)
                      at android.os.Looper.loop(Looper.java:164)
                      at android.app.ActivityThread.main(ActivityThread.java:6541)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

I get this error when I return to my parameter screen.

The first time I go on everything is good, I click on a preference (THIS_ONE) that opens a viewpager with fragments, I do my things and when I click on the arrow back to return to my screen preferably I get this error.

The problem is that I do not implements myself ScrollView, I leave Android managed this. How to fix this problem?

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:custom="http://schemas.android.com/apk/res-auto"
    android:key="@string/preferenceScreen">

    <PreferenceCategory android:title="dfqg">

        <CheckBoxPreference
            android:key="fsdcv"
            android:title="dfg"
            android:summary="fdg"
            android:defaultValue="false"/>

        <CheckBoxPreference
            android:key="dfqg"
            android:title="fdgfd"
            android:defaultValue="false" />

        <CheckBoxPreference
            android:key="dfg"
            android:title="dfgdf"
            android:defaultValue="true"/>

        <com.*.NumberPickerDialogPreference
            android:key="gdfg"
            android:defaultValue="0"
            android:max="40"
            android:title="dfgdfg"
            android:summary="dfgdfg"
            custom:min="0"
            android:persistent="true" />

    </PreferenceCategory>

    <PreferenceCategory android:title="dfg">

        <Preference
            android:key="THIS_ONE"
            android:title="fdgfd" />

        <CheckBoxPreference
            android:key="fdsf"
            android:title="sdfsdf" />

    </PreferenceCategory>

    <PreferenceCategory android:title="sdfsdf">


        <Preference
            android:title="sdfsdf"
            android:key="sdfsd">

        </Preference>

        <Preference
            android:title="sdfdsf"
            android:summary="sdfsdf"
            android:key="fdf">

        </Preference>

    </PreferenceCategory>

    <PreferenceCategory
        android:title="fdsf"
        android:key="fd"
        android:enabled="false">
        <Preference
            android:title="sdfsdf"
            android:key="sdf"></Preference>
        <Preference
            android:title="sdfdf"
            android:key="fd"></Preference>
    </PreferenceCategory>

    <PreferenceCategory
        android:title="sdfdsf"
        android:key="fdsf">
        <CheckBoxPreference
            android:title="dfsfsd"
            android:summary="sdfdsf"
            android:key="fdsfdsf"></CheckBoxPreference>
        <Preference
            android:title="sdfs"
            android:summary="sdfsdfsdf"
            android:key="cds"></Preference>

    </PreferenceCategory>
</PreferenceScreen>
0 Answers
Related