2011-11-29 114 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'' –