在Android的资源xml中转义单引号 [英] Escaping single quotes in resource xml for Android
本文介绍了在Android的资源xml中转义单引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在../res/values/strings.xml中有一个包含字符串的文件,我尝试为该项目提供源文件.这适用于普通文本.问题:我的文字中有单引号,然后尝试转义.许多消息来源建议使用XML文件中的&’
对其进行转义.
I have a file with strings in my ../res/values/strings.xml, which I try to source for my project. This works fine with normal texts.
Problem : I have single quotes in my texts and I try to escape them. Many sources suggest to escape it with '
in XML Files.
但这不适用于我的Eclipse Android项目.当我做一个干净的项目时,它在我的代码中显示错误.(R.class)
But this does not work for me in my Eclipse Android Project. When I do a clean project, it shows errors in my Code. (R.class)
<string name="mystring_id">'Hello'</string>
如何正确逃脱?
推荐答案
您可以在字符串资源中使用 \'
.
You can use \'
in your string resources.
这篇关于在Android的资源xml中转义单引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文