Android xml 文件中的字符串数组中的问题:以非位置格式和 Found 标签 </item> 指定的多个替换,其中 </string-array> 是预期的

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12605684/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 11:10:19  来源:igfitidea点击:

issue in string array in xml file: Multiple substitutions specified in non-positional format and Found tag </item> where </string-array> is expected

androidandroid-resources

提问by esoni

Possible Duplicate:
Android XML Percent Symbol

可能重复:
Android XML 百分比符号

hi mate i have an array in file xml:

嗨,伙计,我在文件 xml 中有一个数组:

<string-array name="type_data_graph">
        <item>Veichle speed (Km/h)</item>
        <item>Engine Rpm (rpm)</item>
        <item>Barometric pressure (kPa absolute)</item>
        <item>Fuel pressure (kPa)</item>
        <item>Fuel Rail pressure of manifold vacuum (kPa)</item>
        <item>Fuel Rail pressure diesel/gasoline (kPa)</item>
        <item>MAF air flow rate (grams/sec)</item>
        <item>Intake MAP (kPa)</item>
         <item>Engine % torque (%) </item>       
......
    </string-array>

when commpile i get error on

编译时出现错误

     <item>Engine % torque (%) </item>       

the error is

错误是

Description Resource Path Location Type error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute? arrays.xml /DashboardDroid/res/values line 43 Android AAPT Problem

Description Resource Path Location Type error: Found tag where is expected arrays.xml /DashboardDroid/res/values line 43 Android AAPT Problem what means ??? i close all tag

说明 资源路径位置类型错误:以非位置格式指定的多个替换;您是要添加 formatted="false" 属性吗?arrays.xml /DashboardDroid/res/values line 43 Android AAPT 问题

说明 资源路径位置类型错误:在预期 arrays.xml /DashboardDroid/res/values line 43 Android AAPT 问题中找到标签是什么意思???我关闭所有标签

回答by G_S

instead of

代替

 Engine % torque (%)

try using

尝试使用

Engine %% torque (%%)

if you need a % in your strings.xml file

如果您需要在 strings.xml 文件中使用 %

or try checking the link here

或尝试检查这里的链接

or else simply try giving

或者干脆尝试给予

 formatted="false" 

in your

在你的

<string-array> 

tag

标签