今天碰到一個(gè)問題,Android 在字符串資源中如何輸出雙引號呢?
直接在 string.xml 中定義 <string name="toast_voice_shot_on">Say "pai zhao" to shot</string>
這樣在使用該字串的時(shí)候是不會顯示成 Say "pai zhao" to shot 的。而是會顯示成 Say pai zhao to shot
**解決方案: 加轉(zhuǎn)義符 \ **
在 string.xml 中定義成 <string name="toast_voice_shot_on">Say "pai zhao" to shot</string>
這樣就會顯示成 Say "pai zhao" to shot