今天有一個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>
作者:歐陽鵬 歡迎轉載,與人分享是進步的源泉!