<string name="weather_fragment_temp_str">%s°~%s°</string>
Multiple annotations found at this line: - error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute? - error: Unexpected end tag string
答案 0 :(得分:2)
这样做的原因是您指定要将多个值替换为此字符串,但是您需要指定每个参数的位置。原因是不同语言的结构不同。
您可以使用带有多个替换的字符串替换,如下所示:
<string name="weather_fragment_temp_str">%1$s°~%2$s°</string>
这样,其他语言可以在不同位置进行替换。例如,您可能需要16°~20°的英语和20°~16°的日语 - 在您的日语strings.xml
中,您只需%2$s°~%1$s°
,然后您的代码保持不变(即当然是一个完全做作的例子。