解决strings.xml格式化占位符错误:Multiple substitutions specified in non-positional format

使用strings.xml进行格式化占位符时报错:

1
Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?

检查后发现是格式化字符串中包含多个占位符导致

解决案例:

1
2
3
<string name="test">HomePage: %1$s, Author: %2$s</string>

<string name="order_total_hint">Total %1$d products(including shipping %2$s%3$.2f)</string>

Powered by AppBlog.CN     浙ICP备14037229号

Copyright © 2012 - 2020 APP开发技术博客 All Rights Reserved.

访客数 : | 访问量 :