【问题标题】:Default Ringtone Preference to silent默认铃声偏好静音
【发布时间】:2014-11-02 10:44:10
【问题描述】:

我在preferences.xml 中有一个铃声偏好,目前默认为系统通知声音。

我想将其默认为静音,但无法找到静音的内容 URI。

    <RingtonePreference
            android:defaultValue="content://settings/system/notification_sound"
            android:key="@string/pref_alarm_tone_scan_notification_sound"
            android:ringtoneType="notification"
            android:showDefault="true"
            android:showSilent="true"
            android:title="@string/pref_alarm_notification_sound_title" />

在 Application 的子类中,我将 xml 文件中的默认值设置如下:

// apply defaults as stored in preferences.xml
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);

【问题讨论】:

  • 该链接是某人未调用 setDefaultValues() 的问题。我实际上希望我的默认设置为静音(并在我的preferences.xml 文件中应用其他默认值。

标签: android android-preferences ringtone


【解决方案1】:

无声的声音是一个空字符串

android:defaultValue=""

【讨论】:

    猜你喜欢
    • 2014-07-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-24
    相关资源
    最近更新 更多