Answers:
在中strings.xml,您可以简单地用反斜杠转义特殊字符(例如双引号):
"message \"quote string 1\" and \"quote string 2\" end message"
但是在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:text="message "quote string 1""
strings.xml是一个大问题。
使用escape characters。要显示双引号,请使用\"
您的代码将是
android:text="message \"quote string 1\" and "quote string 2\" end message"
您可以在任何xml文件中使用Unicode
android:text="message \u0022quote string 1\u0022 and \u0022quote string 2\u0022 end message"
http://www.fileformat.info/info/unicode/char/0022/index.htm那里向下滚动到C / C ++ / Java源代码
TextView.setText(Html.fromHtml("“ " + "YOUR TEXT" + " ”"));
<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中
<string name="good_example">This is a \"good string\".</string>
来源:http : //developer.android.com/guide/topics/resources/string-resource.html