建了个工程叫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>
解决方案 »
- Android2.2 service里加pendingintent 结果widget上面没反应
- jni thread 退出异常 , native thread exited without detaching
- 想在TabHost下嵌套一个listview该怎么做
- 这个"语音识别程序" 指的是什么? 是android的还是第三方的?
- andriod2.1系统怎么配置不好
- 如何跳转到保存联系人页面
- 自己继承的类无法用在xml里
- 如何重新生成R文件
- 在一个有返回值的方法里使用了子线程,如何返回子线程中的值,如下代码中,我在子线程获取到了address的值,但是这个方法的返回结果是空,该如何解决?
- 求个byte数据处理方案,谢谢
- Android中如何实现用户自动设置字体大小啊,急求
- 数组中汉字的苦恼!!!!! 求解
里面没有对menu_settings进行设置吧
android:title="@string/menu_settings"
改成androi:title="文字"也可以的
改成android:title=“随便写点什么”看是否不会报错如果不报错就是你的资源问题