2010-05-22 45 views
13

这真的让我开始疯狂。找不到与main.xml中的名称匹配的资源

<?xml version="1.0" encoding="utf-8"?> 
<TextView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@id+/textview" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:text="@string/hello"/> 

产生以下错误信息:“Error: no resource found that matches the given name (at 'id' with value '@id+/textview')

这是副本,并从Android粘贴的hello world example

回答

8

这只是一个小错字,你需要把“+ @'后',而不是之后 'ID':

<?xml version="1.0" encoding="utf-8"?> 
<TextView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/textview" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:text="@string/hello"/> 
25

@+id@id+似乎教程 是错的!

+0

很好的证明,读谷歌! – AndroidBeginner 2010-05-22 19:09:43

+0

现在已经修复:) – Chris 2010-05-24 21:54:46

+0

我刚刚下载了SDK,仍然是buged – Moak 2010-06-11 06:27:08

相关问题