android - ADT 在 Strings.xml 中显示错误

标签 android xml resources adt

在 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/

相关文章:

android - DialogFragment 中的 ViewPager,IllegalStateException : Fragment does not have a view

android - 旋转项目的交替颜色

android - launchMode ="singleTask"不创建新任务

android - 订阅 MqttAndroidClient 上的主题时出现 NullPointerException

java - 为什么我的 Servlet Filter 程序显示 404 http 错误?

Java 自定义解析器(如 XML)

php - 如何将 child 添加到特定节点

java - 根 url 的匹配和静态资源的服务

解决方案子文件夹中的 C# 资源文件导致 MissingManifestResourceException

android - Google Play 商店是否会从 apk 中删除未使用的资源?