我想在我的strings.xml
文件中创建以下字符串数组:
<string-array name="an_array_columns">
<item>% Select percentage1</item>
<item>% Select percentage2</item>
</string-array>
这里的字符串是"% select percentage“。现在,当我在我的strings.xml中写这段代码时,我得到了以下错误:
Multiple annotations found at this line:
- error: Multiple substitutions specified in non-positional format; did you mean to
add the formatted="false" attribute?
- error: Found tag </item> where </string-array> is expected
我知道我们可以将&
更改为&
,或者将'
更改为\'
,但是我该如何处理百分比符号?
发布于 2012-10-22 20:35:48
你可以使用它的代码。试试这个:%
还要检查类似的问题:Android XML Percent Symbol
发布于 2017-02-14 01:22:10
对我来说,%%
似乎是唯一有效的方法。例如:
<string name="num_percent">%1$d %%</string>
使用
String oneHundredPercentString = getString(R.string.num_percent, 100); // This gives "100 %"
https://stackoverflow.com/questions/13011564
复制相似问题