在 Gingerbread 发布后,我将我的 ADT 更新到了最新版本。现在
<string name="date_format">%d:%d %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
以前的 ADT 版本运行良好。难道我做错了什么?每当有超过 1 个格式说明符时,我都会收到此错误。
最佳答案
或者,您也可以修改 % 格式说明符以使用参数索引,如下所示:
<string name="date_format">%1$d:%2$d %3$s</string>
Android Reference Docs 中有关 Formatter 类的更多信息.
关于android - ADT 在 Strings.xml 中显示错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4484453/