android 错误

来源:互联网 发布:淘宝专业术语英文缩写 编辑:程序博客网 时间:2024/05/22 05:04
1、string.xml中的值含有百分号%,导致整个报错: 
    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 
    - error: Unexpected end tag string 
有两个办法可供选择 
  1.用%%来表示1个%,和转意符号 \ 的用法相同 ,但是使用contex.getString(R.string.xx);读取出来的值带有两个%,再使用String.format()无法达到预期的效果。
  2.如果你的字符串不需要格式化,可以在你的%test% 即可。 

PS:使用第二种方法解决
原创粉丝点击