我收到此错误,我不明白为什么......
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)
当我返回参数屏幕时出现此错误。
我第一次进行一切都很好,我点击一个首选项(THIS_ONE)打开一个带有片段的viewpager,我做我的事情,当我点击箭头返回到我的屏幕时,我最好得到这个错误。
问题是我没有实现自己的ScrollView,我让Android管理了这个。如何解决这个问题?
<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>