问题描述
|
如何设置ListPreference的默认值?
对于我使用的EditTextPreference
editor.putString(\"name\",\"defaultvalue\");
但这在ListPreference中不起作用。
我该怎么做?
解决方法
从xml进行:
android:defaultValue
要么:
onSetInitialValue(boolean restoreValue,Object defaultValue)
// Implement this to set the initial value of the Preference.