请让我知道我要去哪里出错了。
我正在创建一个应用程序,该应用程序的活动之一只能在横向模式下进行。所以我在AndroidManifest.xml文件中添加了以下内容
<activity android:name=".LandScapeImageActivity" android:screenOrientation="landscape"></activity>
我已经创建了一个文件夹
/ res / layout-land
并在其中添加名为see_today_landscape_layout的布局。
在onCreate()
我添加以下内容
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.see_today_landscape_layout);
....
}
但是,当我运行我的应用程序时,出现以下错误
02-06 13:46:14.358: E/AndroidRuntime(13286): FATAL EXCEPTION: main
02-06 13:46:14.358: E/AndroidRuntime(13286): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mid.kew.activities/com.mid.kew.activities.LandScapeImageActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f03002b
02-06 13:46:14.358: E/AndroidRuntime(13286): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2787)
02-06 13:46:14.358: E/AndroidRuntime(13286): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2803)
02-06 13:46:14.358: E/AndroidRuntime(13286): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4066)
02-06 13:46:14.358: E/AndroidRuntime(13286): at android.app.ActivityThread.access$2400(ActivityThread.java:135)
02-06 13:46:14.358: E/AndroidRuntime(13286): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2140)
02-06 13:46:14.358: E/AndroidRuntime(13286): at android.os.Handler.dispatchMessage(Handler.java:99)
02-06 13:46:14.358: E/AndroidRuntime(13286): at android.os.Looper.loop(Looper.java:144)
02-06 13:46:14.358: E/AndroidRuntime(13286): at android.app.ActivityThread.main(ActivityThread.java:4937)
02-06 13:46:14.358: E/AndroidRuntime(13286): at java.lang.reflect.Method.invokeNative(Native Method)
02-06 13:46:14.358: E/AndroidRuntime(13286): at java.lang.reflect.Method.invoke(Method.java:521)
02-06 13:46:14.358: E/AndroidRuntime(13286): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
02-06 13:46:14.358: E/AndroidRuntime(13286): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
02-06 13:46:14.358: E/AndroidRuntime(13286): at dalvik.system.NativeStart.main(Native Method)
02-06 13:46:14.358: E/AndroidRuntime(13286): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f03002b
02-06 13:46:14.358: E/AndroidRuntime(13286): at android.content.res.Resources.getValue(Resources.java:892)
02-06 13:46:14.358: E/AndroidRuntime(13286): at android.content.res.Resources.loadXmlResourceParser(Resources.java:1869)
02-06 13:46:14.358: E/AndroidRuntime(13286): at android.content.res.Resources.getLayout(Resources.java:731)
02-06 13:46:14.358: E/AndroidRuntime(13286): at android.view.LayoutInflater.inflate(LayoutInflater.java:318)
02-06 13:46:14.358: E/AndroidRuntime(13286): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
02-06 13:46:14.358: E/AndroidRuntime(13286): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
02-06 13:46:14.358: E/AndroidRuntime(13286): at android.app.Activity.setContentView(Activity.java:1654)
02-06 13:46:14.358: E/AndroidRuntime(13286): at com.mid.kew.activities.LandScapeImageActivity.onCreate(LandScapeImageActivity.java:103)
02-06 13:46:14.358: E/AndroidRuntime(13286): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1069)
02-06 13:46:14.358: E/AndroidRuntime(13286): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2751)
02-06 13:46:14.358: E/AndroidRuntime(13286): ... 12 more
我在R.java中交叉检查,它具有ID 7f03002b的资源,该资源正在寻找异常并且它存在于此...
我清理并重建项目说了5次,但是仍然出现问题。
奇怪的是,这在昨天有效,而今天却无效。代码是一样的。
see_today_landscape_layout.xml
文件的内容。