带有"%"符号的字符串资源

Moh*_*ikh 3 resources android

我有String.xml并执行本地化.

在String标签中写入内容时,我注意到在第二个"%"符号后附加文本会引发错误.

<string name="result_unlikely">Improbable 20% to 50%</string>//working

<string name="result_unlikely">Improbable 20% to 50% required</string>//not working
Run Code Online (Sandbox Code Playgroud)

任何的想法?

注意:我知道我可以编写运行时但是如上所述我正在实现Localization,所以使用string.xml要好得多

Moh*_*ikh 7

解决了.

通过添加formatted ="false"问题解决.

<string name="result_unlikely" formatted="false">Improbable 20% to 50% required</string>
Run Code Online (Sandbox Code Playgroud)