Android 如何放置“-”;在string.xml文件中,但不转义

Android 如何放置“-”;在string.xml文件中,但不转义,android,Android,我有一个configuration.xml文件,我保存了所有文件(是的,你猜对了!)。。配置字符串、值等 其中一个值是一个字符串,它是oauth客户端id,并且有一个连字符 <string name="server_clientid">5467656-blahblahblah.apps.googleusercontent.com</string> 好的,这很公平,但是如果我用这个转义,那么当我在应用程序中获取它时,客户端id是无效的。我不能用–;基本上。我该如

我有一个configuration.xml文件,我保存了所有文件(是的,你猜对了!)。。配置字符串、值等

其中一个值是一个字符串,它是oauth客户端id,并且有一个连字符

<string name="server_clientid">5467656-blahblahblah.apps.googleusercontent.com</string>

好的,这很公平,但是如果我用这个转义,那么当我在应用程序中获取它时,客户端id是无效的。我不能用–;基本上。我该如何解决这个问题呢?

你把你的价值观包装起来

<![CDATA[ ]]> 

这会阻止解析器解析内容。例如

<string name="server_clientid"><![CDATA[ 5467656-blahblahblah.apps.googleusercontent.com ]]></string>

您还可以抑制lint警告(该警告为假,因为划线未在印刷上下文中使用):


...
5467656-blahblahblah.apps.googleusercontent.com
“n短划线”(-,-)和“m短划线”(-) 字符用于范围(n破折号)和中断(m破折号)。使用 这些字符而不是普通的连字符可以使文本更容易阅读,并使您的 应用程序将看起来更加抛光


将较小的“-”替换为较大的“-”。你可以走了。

这是警告。。您可以使用此字符串..在读取UUID时,是什么阻止您解析en破折号?的副本。您将在那里得到答案。我非常确定
放在
字符串的
标记中。
<string name="server_clientid"><![CDATA[ 5467656-blahblahblah.apps.googleusercontent.com ]]></string>
<resources xmlns:tools="http://schemas.android.com/tools">

 ...

<string name="server_clientid" tools:ignore="TypographyDashes">5467656-blahblahblah.apps.googleusercontent.com</string>