为了使用方便也是为了代码规范化,我们都将文字信息放在res-values-strings.xml中,

因为开发中需要用到将文字的换行,百度了一下,可以将文字段信息直接在strings.xml文件中换行

具体做法

<string name="aaaa">属性\n攻击力+60点,并附带18\%%吸血效果\n\n使用\n3秒内普通攻击附带84\%%吸血效果,冷却时间50秒。</string>

我们看到其中\n就是换行符,

需要注意的是在文字段信息中,想要输出%号可不是直接打一个百分比号,否则会出现错误

1 Description    Resource    Path    Location    Type
2 error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?    strings.xml    /群雄/res/values    line 16    Android AAPT Problem
1 Description    Resource    Path    Location    Type
2 error: Unexpected end tag string    strings.xml    /群雄/res/values    line 16    Android AAPT Problem

出现这两种错误,正确的做法就是在想要输出的%号之间加一个\% ,即\%%

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-17
  • 2021-04-23
  • 2022-01-19
  • 2021-11-05
  • 2021-06-24
猜你喜欢
  • 2021-05-16
  • 2021-06-28
  • 2021-09-30
  • 2021-08-27
  • 2022-01-05
  • 2021-11-29
  • 2021-12-28
相关资源
相似解决方案