2011-11-29 51 views
9

Tôi có mã này cho màn hình Sở thích của tôi,RingtonePreference Giá trị mặc định

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

tôi muốn thiết lập giá trị mặc định cho RingtonePreference để Default Notification Sound trong xml, làm thế nào có thể làm điều đó?

Cảm ơn

+7

Tôi thấy điều này trên SO: [RingtonePreference DefaultValue] [1] [1]: http://stackoverflow.com/questions/4235018/can-i-insert-a-androiddefaultvalue-trait-for-ringt onepreference-via-xml – Joe

Trả lời

31

tôi tìm thấy giải pháp, nhờ Joe, defaultValue Phải:

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

@ d-a-v-o-o-d sau khi thực hiện ** 'Kiểm tra mã ...' ** thông qua trình đơn Phân tích âm thanh của Android, tôi nhận được nội dung 'Không thể giải quyết biểu tượng': // settings/system/notification_sound'' –

Các vấn đề liên quan