【问题标题】:Multiple annotations found at this line:在此行找到多个注释:
【发布时间】:2013-01-01 12:47:47
【问题描述】:

面对这个错误

Multiple annotations found at this line:
- error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" 
 attribute?
- error: Unexpected end tag string

这是我的代码

<resources>
   <string name="app_name">SpeedTest</string>
   <string name="network_edge">Network : EDGE</string>
   <string name="network_3g">Network : 3G</string>
   <string name="network_detecting">Network : Detecting </string>

   <string name="update_speed">%s kbit/sec</string>
   <string name="update_downloaded">Downloaded %s of %s</string>
   <string name="update_connectionspeed">Connection time %s ms</string>

   <string name="update_downloaded_complete">Downloaded %s @ %s kbit/sec</string>

</resources>

面临这一行的错误

<string name="update_downloaded">Downloaded %s of %s</string>

【问题讨论】:

    标签: android xml string


    【解决方案1】:

    如果你想替换两个字符串,这应该是正确的:

    <string name="update_downloaded">Downloaded %1$s of %2$s</string>
    

    看这里:http://mobile.tutsplus.com/tutorials/android/android-sdk-format-strings/

    【讨论】:

      【解决方案2】:

      添加这个:

       <string name="update_downloaded" formatted="false">Downloaded %s of %s</string> 
      

      因为你在这个字符串中有特殊字符。

      【讨论】:

        猜你喜欢
        • 2015-12-06
        • 2017-12-16
        • 1970-01-01
        • 1970-01-01
        • 2015-10-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多