我创建了listpreference以选择值,但是当我想设置默认值时,它表示无法解析符号' Radio1'。
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="Settings">
<ListPreference
android:title="Select radio station"
android:key="station"
android:summary="Select radio station you want to listen"
android:defaultValue="Radio1"
android:entries="@array/radio_stations"
android:entryValues="@array/radio_stations"
android:icon="@drawable/ic_radio_white_48dp">
</ListPreference>
</PreferenceCategory>
</PreferenceScreen>
arrays.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="radio_stations">
<item>Radio1</item>
<item>Radio2</item>
<item>Radio3</item>
<item>Radio4</item>
</string-array>
</resources>