如何解决Android中的多注释错误,原因是什么? %s°~%s°

如何解决Android中的多注释错误,原因是什么? %s°~%s°,android,Android,在此行找到多个批注: -错误:以非位置格式指定了多个替换;是否要添加格式化的=“false” 属性 -错误:意外的结束标记字符串原因是您指定要将多个值替换到此字符串中,但需要指定每个参数的位置。这是因为不同的语言结构不同 可以将字符串替换与多个替换一起使用,如下所示: Multiple annotations found at this line: - error: Multiple substitutions specified in non-positional format; di

在此行找到多个批注: -错误:以非位置格式指定了多个替换;是否要添加格式化的=“false” 属性
-错误:意外的结束标记字符串原因是您指定要将多个值替换到此字符串中,但需要指定每个参数的位置。这是因为不同的语言结构不同

可以将字符串替换与多个替换一起使用,如下所示:

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
%1$s°~%2$s°

这样,其他语言可以在不同的位置进行替换。例如,您可能需要16°~20°英语,20°~16°日语-在日语
strings.xml
中,您只需执行
%2$s°~%1$s°
,然后代码保持不变(当然,这是一个完全人为的示例)。

当然,如果您实际上只是想显示一个百分比符号,那么这就是。 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
<string name="weather_fragment_temp_str">%1$s°~%2$s°</string>