Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/322.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 带xliff的AndroidStudio错误_Java_Android_Xml_Localization_Xliff - Fatal编程技术网

Java 带xliff的AndroidStudio错误

Java 带xliff的AndroidStudio错误,java,android,xml,localization,xliff,Java,Android,Xml,Localization,Xliff,我正在学习本地化和显示文本,具体取决于设备上的默认区域设置 一行代码产生了问题,我真的不明白为什么,因为示例项目有完全相同的代码,没有任何错误 strings.xml getString(R.string.order\u summary\u chocolate,hascocolate)带红色下划线并显示 我真的不明白,为什么第一个字符串order\u summary\u whippeted\u cream工作得非常好,而order\u summary\u chocolate给了我这些错误-它们是

我正在学习本地化和显示文本,具体取决于设备上的默认区域设置

一行代码产生了问题,我真的不明白为什么,因为示例项目有完全相同的代码,没有任何错误

strings.xml
getString(R.string.order\u summary\u chocolate,hascocolate)
带红色下划线并显示

我真的不明白,为什么第一个字符串
order\u summary\u whippeted\u cream
工作得非常好,而
order\u summary\u chocolate
给了我这些错误-它们是相同的,只是名称不同


希望我没有监督任何明显的问题://

请不要添加代码的图片,在此处和此处添加代码。完成后,我将感谢您对格式的任何建议:)尝试清理并重建项目尝试过它,不会解决此问题:/
<!--
  Whipped cream topping for the order summary. It will be shown in the format of
  "Add whipped cream? true" or "Add whipped cream? false". [CHAR LIMIT=NONE]
-->
<string name="order_summary_whipped_cream">Add Whipped Cream? 
<xliff:g id="hasWhippedCream" example="true">%b</xliff:g></string>

<!--
  Chocolate topping for the order summary. It will be shown in the format of
  "Add chocolate? true" or "Add chocolate? false". [CHAR LIMIT=NONE]
-->
<string name="order_summary_chocolate">Add Chocolate? 
<xliff:g id="hasChocolate" example="true">%b</xliff:g></string>
/**
 * This method creates the string to display
 */
private String createOrderSummary
(String enteredName, int price, boolean hasWhippedCream, boolean hasChocolate)
{
    String orderSummary = getString(R.string.order_summary_name, enteredName)
                 + "\n" + getString(R.string.order_summary_whipped_cream, hasWhippedCream)
                 + "\n" + getString(R.string.order_summary_chocolate, hasChocolate)
                 + "\n" + getString(R.string.order_summary_quantity, quantity)
                 + "\n" + getString(R.string.order_summary_price, price)
                 + "\n" + getString(R.string.thank_you);

    return orderSummary;
}