我在strings.xml文件中写了以下内容:

<string name="game_settings_dragNDropMove_checkBox">Move by Drag&Drop</string>

我得到了以下错误:

The reference to entity "Drop" must end with the ';' delimiter.

我怎么能写字符&在字符串。xml?


当前回答

&在字符串中:

<string name="string_abc">Translate &amp; Scan Objects</string>

输出将是:

翻译和扫描对象

其他回答

这是我的一个问题,我的解决方法如下:使用&gt;对于>,&lt;对于<,&For &,"'" For ', &quot For \"\"

你可以这样写

<string name="you_me">You &#38; Me<string>

输出:你和我

应该是这样的:

<string name="game_settings_dragNDropMove_checkBox">Move by Drag&amp;Drop</string>

对于特殊字符,我通常使用Unicode定义,例如“&”,如果我是正确的:\u0026。这里有一个很好的参考页面:http://jrgraphix.net/research/unicode_blocks.php?block=0