Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
转义Android资源xml中的单引号_Android_Xml_Resources - Fatal编程技术网

转义Android资源xml中的单引号

转义Android资源xml中的单引号,android,xml,resources,Android,Xml,Resources,我在../res/values/strings.xml中有一个带有字符串的文件,我试图为我的项目获取该文件的源代码。这适用于正常文本。 问题:我的文章中有单引号,我试图避开它们。许多消息来源建议使用&apos 但这在我的EclipseAndroid项目中并不适用。当我执行一个干净的项目时,它会显示代码中的错误。(R级) &apos;你好&apos; 如何正确转义?您可以在字符串资源中使用\'。使用双引号: <string name="mystring_id">"'Hello'"&l

我在../res/values/strings.xml中有一个带有字符串的文件,我试图为我的项目获取该文件的源代码。这适用于正常文本。 问题:我的文章中有单引号,我试图避开它们。许多消息来源建议使用
&apos

但这在我的EclipseAndroid项目中并不适用。当我执行一个干净的项目时,它会显示代码中的错误。(R级)

&apos;你好&apos;

如何正确转义?

您可以在字符串资源中使用
\'

使用双引号:

<string name="mystring_id">"'Hello'"</string>
“‘你好’”

您需要使用

\ before '
etc不应该是这样的

didn\'t
母亲的名字

使用
{tools:ignore=“StringEscaping”}
此工具属性,您可以添加您想要的单引号

@Karakuri:将此作为您的答案发布。这似乎不起作用。当我尝试使用此技术运行我的应用程序时,编译器会删除我的\并抱怨没有转义撇号。@Essah我也经历了这个过程。错误是试图编辑生成的中间文件而不是原始的strings.xml。这应该是可以接受的答案。这比在大文本块中转义其他字符要干净得多。
didn\'t
 <string name="forgot_password_body" tools:ignore="StringEscaping">Mother's name</string>