找不到符合给定名称的资源(在'title',值为'@ string / action_settings') [英] No resource found that matches the given name (at 'title' with value '@string/action_settings')
问题描述
所以我最近(像今天最近)开始试图在日食中工作。我一直在追踪android开发者初学者课程,一切顺利,直到这一点。我已经建立了一个简单的用户界面( http:// developer.android.com/training/basics/firstapp/building-ui.html#Button ),并且做了一切话,但是当我尝试运行它时,它表示
找不到与给定名称匹配的资源(title,值为@ string / action_settings)。
我回去检查了一切,我做了一切,他们解释,它仍然这样做?我是一个总的noob,所以也许我只是错过了一些东西,但我不知道什么。我重新启动了eclipse,它仍然不会运行该应用程序,并表示百万分之一的时候我有一个错误。
这是我的设计表:
在布局activity_main.xml中
<?xml version =1.0 = UTF-8 >?;
< LinearLayout xmlns:android =http://schemas.android.com/apk/res/android
xmlns:tools =http://schemas.android.com/tools
android:layout_width =match_parent
android:layout_height =match_parent
android:orientation =horizontal>
< EditText android:id =@ + id / edit_message
android:layout_weight =1
android:layout_width =0dp
android:layout_height =wrap_content
android:hint =@ string / edit_message/>
< Button
android:layout_width =wrap_content
android:layout_height =wrap_content
android:text =@ string / button_send/>
< / LinearLayout>
在值
string.xml
<?xml version =1.0encoding =utf-8?>
< resources>
< string name =app_name> My First App< / string>
< string name =edit_message>输入消息< / string>
< string name =button_send>发送< / string>
< string name =menu_settings>设置< / string>
< string name =title_activity_main> MainActivity< / string>
< / resources>
这就是我搞砸了。我没有看到一个问题?
我缺少一些明显的东西?
ha - 我正在做教程,并得到同样的事情。您复制/粘贴了整个 strings.xml
文件,但此文件缺少应用程序需要的值。这是他们的教程中的错误。
将此行添加回strings.xml:
string name =action_settings> something here< / string>
我在哪里放这里的东西我不记得原文是什么。 >
问题是main.xml(在res / menu下),当然我们在教程中没有触及,引用了字符串action_settings。当您从他们的示例复制/粘贴整个string.xml时,这被删除。
So I recently (like today recently) began to try to work in eclipse. I've been following android developers beginners course, and everything went fine until this point. I've gotten to building a simple user interface (http://developer.android.com/training/basics/firstapp/building-ui.html#Button) and did EVERYTHING word for word, but when I try to run it it says that
No resource found that matches the given name (at 'title' with value '@string/action_settings').
I went back and checked everything, and I did everything as they explained and it still does this? I'm a total noob, so maybe I'm just missing something but I don't know what. I restarted eclipse, and it still wouldn't run the app, and said for the millionth time I have an error.
This is my design sheet:
In layout activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<EditText android:id="@+id/edit_message"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="@string/edit_message" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_send" />
</LinearLayout>
in values string.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">My First App</string>
<string name="edit_message">Enter a message</string>
<string name="button_send">Send</string>
<string name="menu_settings">Settings</string>
<string name="title_activity_main">MainActivity</string>
</resources>
and that's ALL I've messed with. I don't see a problem?
Am I missing something obvious?
ha - I am doing the tutorial and got the same thing. You copied/pasted the entire strings.xml
file, but this file is missing a value that the app needs. It's a bug in their tutorial.
Add this line back to strings.xml:
<string name="action_settings">something here</string>
Where I put "something here" I can't remember what the original text was.
The problem is that main.xml (under res/menu), which of course we didn't touch in the tutorial, references the string "action_settings". This was deleted when you copied / pasted the entire string.xml from their example.
这篇关于找不到符合给定名称的资源(在'title',值为'@ string / action_settings')的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!