Android中正在多次调用首选项onCreateView

时间:2014-12-15 10:04:53

标签: android android-preferences preferencescreen

我有一个PreferenceScreen包含几个Preference对象。 PreferenceScreen中的第一个Preference是自定义首选项。现在的问题是该自定义首选项的onCreateView()多次调用。如果我改变首选项的顺序,那么它只被调用一次。为什么会出现这种情况?

下面是我的xml文件。我在PreferenceFragment中添加了这个首选项文件。

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >

    <com.android.view.CustomPreference
        android:key="pref0" />

    <Preference
        android:key="pref1"
        android:layout="@layout/preferences_row_view" />

    <Preference
        android:key="pref2"
        android:layout="@layout/preferences_row_view" />

    <Preference
        android:key="pref3"
        android:layout="@layout/preferences_row_view" />

</PreferenceScreen>

0 个答案:

没有答案
相关问题