2011-11-29 120 views
9

我有這樣的代碼爲我的首屏,RingtonePreference默認值

<RingtonePreference 
    android:key="notification_sound" 
    android:ringtoneType="notification" 
    android:title="Notification Sound" 
    android:showDefault="true" 
    android:showSilent="true" /> 

我要爲RingtonePreference以XML Default Notification Sound設置默認值,該怎麼辦呢?

由於

+7

我發現這個上SO: [RingtonePreference默認值] [1] [1]:http://stackoverflow.com/questions/4235018/can-i-insert-a-androiddefaultvalue-trait-for-ringt one preference-via-xml – Joe

回答

31

我找到的解決方案,由於Joe,默認值必須是:

android:defaultValue="content://settings/system/notification_sound" 
+0

@ d-a-v-o-o-d通過Android Sudio Analyze菜單執行**'Inspect Code ...'**後,我得到'Can not resolve symbol'content:// settings/system/notification_sound'' –