Pal*_*alo 403 string android special-characters
我在strings.xml文件中写了以下内容:
<string name="game_settings_dragNDropMove_checkBox">Move by Drag&Drop</string>
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
The reference to entity "Drop" must end with the ';' delimiter.
Run Code Online (Sandbox Code Playgroud)
我怎样才能在strings.xml中写字符?
Bob*_*mer 986
编码:
&
Run Code Online (Sandbox Code Playgroud)
Mos*_*oss 158
对于特殊字符,我通常使用Unicode定义,对于'&'例如:\ u0026如果我是正确的.这是一个很好的参考页面:http://jrgraphix.net/research/unicode_blocks.php?block = 0
小智 45
这是我的问题,我的解决方案如下:>用于<,<for>,<for,>for,&for ,for \"\"
Khe*_*raj 10
即使你的问题得到了解答,我仍然希望告诉更多像这样的实体.这些是html entities,所以在android中你会写它们像:
替换如下:
& with &
> with >
< with <
" with ", “ or ”
' with ', ‘ or ’
} with }
Run Code Online (Sandbox Code Playgroud)
它应该是这样的:
<string name="game_settings_dragNDropMove_checkBox">Move by Drag&Drop</string>
Run Code Online (Sandbox Code Playgroud)
&在字符串中,例如:
<string name="string_abc">Translate & Scan Objects</string>
Run Code Online (Sandbox Code Playgroud)
输出将是:
翻译和扫描对象
也可以将字符串的内容放入 XML CDATA,就像 Android Studio 为您所做的那样Extract string resource
<string name="game_settings_dragNDropMove_checkBox"><![CDATA[Move by Drag&Drop]]></string>
| 归档时间: |
|
| 查看次数: |
252943 次 |
| 最近记录: |