我在strings.xml文件中写了以下内容:
<string name="game_settings_dragNDropMove_checkBox">Move by Drag&Drop</string>
我得到了以下错误:
The reference to entity "Drop" must end with the ';' delimiter.
我怎么能写字符&在字符串。xml?
我在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="travels_tours_pvt_ltd"><![CDATA[Travels & Tours (Pvt) Ltd.]]></string>
应该是这样的:
<string name="game_settings_dragNDropMove_checkBox">Move by Drag&Drop</string>
这是我的一个问题,我的解决方法如下:使用>对于>,<对于<,&For &,"'" For ', " For \"\"
我发现的最简单的方法是将“&”替换为对应的Unicode。对于上面给出的例子,写如下:
<string name="game_settings_dragNDropMove_checkBox">Move by Drag\u0026Drop</string>
我发布这个是因为上面的编码都不适合我。
我发现用序列替换&作为XML字符串资源工作。如:
<string name="webLink"><a href="https://www.example.com?param1=option1&param2=option2">click here</a></string>