I want to include an item in my preferences.xml
file that it contains a special character @
.
<EditTextPreference
android:title="@string/pref_char_pares_title"
android:summary="@string/pref_char_pares_summary"
android:key="charseppares"
android:defaultValue="@"/>
But I have an error in line android:defaultValue="@"
(error: Error: No resource type specified (at 'defaultValue' with value '@').
I want to use the character @ like separator character in my strings. Thanks in Advance
Can you try this
<EditTextPreference
android:title="@string/pref_char_pares_title"
android:summary="@string/pref_char_pares_summary"
android:key="charseppares"
android:defaultValue="\@"/>
//you can also use like this to show special char
Unicode number: U+0040
HTML-code: @
Little late, but I had the same problem and maybe it will be helpful for somebody.
<EditTextPreference
android:title="@string/pref_char_pares_title"
android:summary="@string/pref_char_pares_summary"
android:key="charseppares"
android:defaultValue="\u0040"/>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.