zoukankan      html  css  js  c++  java
  • 安卓开发中strings.xml的使用

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

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

    具体做法

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

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

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

    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

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

  • 相关阅读:
    关于Windows窗口框架
    如何获取桌面截图
    浅析Windows安全相关的一些概念
    怎样才算会一门编程语言
    COM思想的背后
    XP之后Windows的一些变化
    智能指针与库
    SOUI开发应用展示2
    在SOUI中支持高分屏显示
    SOUI Editor使用教程
  • 原文地址:https://www.cnblogs.com/xqxacm/p/4357997.html
Copyright © 2011-2022 走看看