這裏我有我的偏好在xml文件夾中。無論我將其設置爲「defaultValue」,當我打開我的偏好活動時,我總是會在視覺上取消選中框。這是一種錯誤嗎?複選框始終未選中(無論默認值是什麼)
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<CheckBoxPreference
android:title="Enabled"
android:defaultValue="true"
android:key="checkbox_enabled_disabled"/>
</PreferenceScreen>
看看這個問題的類似問題:http://stackoverflow.com/q/3907830/804773 – Grambot
我已經看到了答案,但它似乎不適合我。我實際上覆制/粘貼代碼,並且它不起作用。 – rootpanthera