我试图在 XML 文件的 TextView 中用双引号显示一些单词,但它不起作用。
<TextView
style="@style/TextStyle"
android:text="message "quote string 1" and "quote string 2" end message"
android:id="@+id/lblAboutPara3"
android:autoLink="web"/>
有人知道解决办法吗?
最佳答案
在 strings.xml
中,您可以简单地使用反斜杠转义特殊字符(例如双引号):
"message \"quote string 1\" and \"quote string 2\" end message"
但在 View xml(例如 layout.xml
)中,您必须使用 HTML 字符实体(例如 "
):
"message "quote string 1" and "quote string 2" end message"
更多信息,请访问 http://developer.android.com/guide/topics/resources/string-resource.html
关于android - 如何在 TextView 中显示双引号(“)符号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6421507/