建了个工程叫helloandroid。res里面的layout文件代码如下<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="161dp"
android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/activity_main_title"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/continue_lable"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/new_game_lable"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/about_lable"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/exit_lable"/>
</LinearLayout>
调试后出现这样的错误:[2012-12-03 19:54:13 - helloandroid] G:\JAVA\myeclipse源文件\helloandroid\res\menu\activity_main.xml:3: error: Error: No resource found that matches the given name (at 'title' with value '@string/menu_settings').
我大概能够看到好像是一个menu文件夹下的activity_main.xml文件不对劲。又不知道怎么搞,高手指点一下这是什么文件,怎么设置?这是我menu下的代码:
<menu xmlns:android="http://schemas.android.com/apk/res/android" > <item
android:id="@+id/menu_settings"
android:orderInCategory="100"
android:showAsAction="never"
android:title="@string/menu_settings"/></menu>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="161dp"
android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/activity_main_title"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/continue_lable"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/new_game_lable"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/about_lable"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/exit_lable"/>
</LinearLayout>
调试后出现这样的错误:[2012-12-03 19:54:13 - helloandroid] G:\JAVA\myeclipse源文件\helloandroid\res\menu\activity_main.xml:3: error: Error: No resource found that matches the given name (at 'title' with value '@string/menu_settings').
我大概能够看到好像是一个menu文件夹下的activity_main.xml文件不对劲。又不知道怎么搞,高手指点一下这是什么文件,怎么设置?这是我menu下的代码:
<menu xmlns:android="http://schemas.android.com/apk/res/android" > <item
android:id="@+id/menu_settings"
android:orderInCategory="100"
android:showAsAction="never"
android:title="@string/menu_settings"/></menu>
里面没有对menu_settings进行设置吧
android:title="@string/menu_settings"
改成androi:title="文字"也可以的
改成android:title=“随便写点什么”看是否不会报错如果不报错就是你的资源问题