android - 如何在 TextView 中显示双引号(“)符号?

标签 android xml string

我试图在 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 &quot;quote string 1&quot; and &quot;quote string 2&quot; end message"

更多信息,请访问 http://developer.android.com/guide/topics/resources/string-resource.html

关于android - 如何在 TextView 中显示双引号(“)符号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6421507/

相关文章:

java - Android Listview 显示 ArrayList 中的最后一个元素

android - 将相机图像保存到目录中

android - 在xml文件中添加标签栏

javascript - 正则表达式获取两个字符串之间的所有字符串

android - Admob 注册/登录导致空白页面

java - 将 ADT bundle 从一台 ubuntu 计算机复制到另一台 eclipse 后无法打开

xml - xquery 中的 SUM 和 GROUP BY 以及 1 个 xml 文件

javascript - 解析 Youtube 视频源 XML

Java字符串包含

php - 使用 PHP 将字符串分成两半(Word-Aware)