字符串不能包含两个'%'

时间:2015-06-17 06:29:58

标签: java android xml string

这一切都发生在我的Project -> res -> values -> strings.xml文件中。

我的字符串如下:

<string name="Bellowy">"During its action, if HP is less than 50%, increase all your creatures ATK by 30% during their next basic ATK"</string>

控制台输出此错误strings.xml:98: error: Unexpected end tag string。我已经确定在R.java文件中没有正确注册两个%符号。如何修复此错误,并在%中有两个Strings.xml个符号?

2 个答案:

答案 0 :(得分:2)

由于https://api.instagram.com/v1/tags/xxx/media/recent.json?access_token=xxxxx&max_id=996890856542960826'%'是转义字符,因此必定会造成一些麻烦。您可以使用%%

答案 1 :(得分:1)

正如我所用,你可以通过两种方式消除这个问题

添加格式化属性

<string name="Bellowy" formatted="false">"During its action, if HP is less than 50%, increase all your creatures ATK by 30% during their next basic ATK"</string>

添加%%而不是%

<string name="Bellowy">"During its action, if HP is less than 50%%, increase all your creatures ATK by 30%% during their next basic ATK"</string>