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

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

  • 相关阅读:
    Java后台校验手机号和邮箱
    centos7安装redis
    centos7安装mysql5.7
    VUE环境运行搭建
    Oracle11gR2安装
    VisualSvn-Server搭建
    SpringCloud-Hoxton.SR1-config整合
    项目简介
    linux常用命令
    JAVA NIO
  • 原文地址:https://www.cnblogs.com/xqxacm/p/4357997.html
Copyright © 2011-2022 走看看