簡體   English   中英

設置 ListPreference 的默認值

[英]Set default value of ListPreference

如何設置 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.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM