[英]Set default value of ListPreference
How I can set the default value of the ListPreference?如何设置 ListPreference 的默认值?
For the EditTextPreference i used对于我使用的 EditTextPreference
editor.putString("name","defaultvalue");
but this doesn't work in ListPreference.但这在 ListPreference 中不起作用。
How i can do this?我怎么能做到这一点?
Do it from xml:从 xml 开始:
android:defaultValue
or:或者:
onSetInitialValue(boolean restoreValue, Object defaultValue)
// Implement this to set the initial value of the Preference.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.