如何显示双引号(")符号在Android的文本视图视图、符号、文本、双引号

2023-09-14 23:02:22 作者:春天里

我想显示在双引号中的一些话,在文本查看XML文件中。但它不工作。请帮助我。

I'm trying to display some words in double quotes, in Text view in in xml file. But its not working. Pls help me.

    <TextView 
    style="@style/TextStyle" 
    android:text="message "quote string 1" and "quote string 2" end message" 
    android:id="@+id/lblAboutPara3" 
    android:autoLink="web"/>    

任何人知道解决方案,这个.............

Any one knows solution for this.............

推荐答案

的strings.xml ,你可以简单地转义特殊字符(如双引号)用一个反斜杠

In the strings.xml, you can simply escape special characters (eg double quotes) with a backslash :

"message \"quote string 1\" and \"quote string 2\" end message"

但在看法XML(如 layout.xml ),您必须使用HTML字符实体(如&放大器; QUOT; ):

But in views xml (eg layout.xml), you have to use HTML character entities (like &quot;) :

"message &quot;quote string 1&quot; and &quot;quote string 2&quot; end message"