简体   繁体   English

android:在@string处找不到资源

[英]android: no resource found at @string

My android app is complaining about resource missing, which I do think has been included and worked great in previous version of android. 我的android应用程序抱怨资源丢失,我认为该资源已包含在早期版本的android中,并且效果很好。

eg, 例如,

menu.xml:27: error: Error: No resource found that matches the given name (at 'title' with value '@string/lookup_about'). menu.xml:27:错误:错误:找不到与给定名称匹配的资源(在“ title”处,值为“ @ string / lookup_about”)。

<item
        android:id="@+id/about"
        android:title="@string/lookup_about" 
        android:icon="@drawable/ic_menu_help"/>

In string.xml, I've defined 在string.xml中,我定义了

<string name="lookup_about">About</string>

Update: 更新:

I found that in one case, only the 2nd @string/spinder_prompt was complained by eclipse. 我发现在一种情况下,eclipse只抱怨了第二个@ string / spinder_prompt。 The first one is not 第一个不是

<TextView
            android:id="@+id/refresh"
            android:text="@string/spinder_prompt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1" 
            android:textSize="16dip" 
            android:typeface="sans" 
            android:layout_gravity="left" 
            android:textColor="#ffffff"
            />

        <Spinner android:id="@+id/Spinner01"
            android:gravity="center_horizontal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:prompt="@string/spinder_prompt" 
            android:layout_weight="0.02"/>

In my strings.xml, 在我的strings.xml中,

<string name="spinder_prompt">Choose the number of items to show</string> 

FYI. 仅供参考。 This code was built and deployed and tested on Android 2.2 systems without any issues. 此代码是在Android 2.2系统上构建,部署和测试的,没有任何问题。

Problem solved. 问题解决了。 The reason is due to the upgrade from 2.1-> 3.0. 原因是由于从2.1-> 3.0升级。 The automatically generated R.java cannot update itself, one has to "edit" that file and save it. 自动生成的R.java无法自我更新,必须“编辑”该文件并将其保存。 Then problem solved. 然后问题解决了。 Developers are experiencing similar issues...http://www.coderanch.com/t/466092/Android/Mobile/android-eclipse 开发人员正在遇到类似的问题... http://www.coderanch.com/t/466092/Android/Mobile/android-eclipse

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM