zl程序教程

您现在的位置是:首页 >  APP

当前栏目

Android string.xml 双引号问题的记录

2023-02-18 16:34:04 时间

我们知道 在string.xml中加了 " ,但是跑到手机上时不显示引号,我们知道原因是没有加 \ 进行转译,加上转译符号就好了。

然后就是 当字符串中有 "...之类的符号时, AndroidStudio 会让这个字符串变黄并提示你要改成 xxx"对应的提示就是",开始以为改成"之后效果会自动对 " 进行转译,然后实际上并没有。

看以下5个字符串显示的对比。

<string name="hello1">"Hello1"</string>
<string name="hello2">\"Hello2\"</string>
<string name="hello3">&quot;Hello3&quot;</string>
<string name="hello4">\&quot;Hello4&quot;</string>
<string name="hello5">\"Hello5\&quot;</string>

以上