今天有一个Android新手使用strings.xml进行格式化的时候报了占位符错误, Multiple substitutions specified in non-positional format; did you mean to add the formatted=”false” attribute? ,问我该如何解决?
具体错误描述如下所示:

我看了下他的strings.xml的源代码,报错的那一行代码是这样写的:
检查后发现是string.xml中的 %s 导致编译失败,应该把%s 改成%1$s的形式。
将
改成
然后重新编译即可成功编译。
可参考文档:
<a href="http://blog.csdn.net/ouyang_peng/article/details/16804049">http://blog.csdn.net/ouyang_peng/article/details/16804049</a>
<a href="http://blog.csdn.net/xiaoyaovsxin/article/details/8450056">http://blog.csdn.net/xiaoyaovsxin/article/details/8450056</a>
<a href="http://blog.csdn.net/jabony/article/details/29577203">http://blog.csdn.net/jabony/article/details/29577203</a>
作者:欧阳鹏 欢迎转载,与人分享是进步的源泉!