应用程序在横向模式下崩溃

时间:2014-05-24 00:55:53

标签: java android xml eclipse

当我在清单中设置android:screenOrientation =“landscape”和启动屏幕的xml文件时,它会崩溃并给我这些错误

05-23 20:52:20.035: D/gralloc_goldfish(1293): Emulator without GPU emulation detected.
05-23 20:52:22.775: D/AndroidRuntime(1293): Shutting down VM
05-23 20:52:22.775: W/dalvikvm(1293): threadid=1: thread exiting with uncaught exception (group=0xb2a63ba8)
05-23 20:52:22.795: E/AndroidRuntime(1293): FATAL EXCEPTION: main
05-23 20:52:22.795: E/AndroidRuntime(1293): Process: com.example.apocalypse, PID: 1293
05-23 20:52:22.795: E/AndroidRuntime(1293): java.lang.RuntimeException: Unable to start activity        ComponentInfo{com.example.apocalypse/com.example.apocalypse.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
05-23 20:52:22.795: E/AndroidRuntime(1293):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
05-23 20:52:22.795: E/AndroidRuntime(1293):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
05-23 20:52:22.795: E/AndroidRuntime(1293):     at android.app.ActivityThread.access$800(ActivityThread.java:135)
05-23 20:52:22.795: E/AndroidRuntime(1293):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
05-23 20:52:22.795: E/AndroidRuntime(1293):     at android.os.Handler.dispatchMessage(Handler.java:102)
05-23 20:52:22.795: E/AndroidRuntime(1293):     at android.os.Looper.loop(Looper.java:136)
05-23 20:52:22.795: E/AndroidRuntime(1293):     at android.app.ActivityThread.main(ActivityThread.java:5017)
05-23 20:52:22.795: E/AndroidRuntime(1293):     at java.lang.reflect.Method.invokeNative(Native Method)
05-23 20:52:22.795: E/AndroidRuntime(1293):     at java.lang.reflect.Method.invoke(Method.java:515)
05-23 20:52:22.795: E/AndroidRuntime(1293):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
05-23 20:52:22.795: E/AndroidRuntime(1293):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
05-23 20:52:22.795: E/AndroidRuntime(1293):     at dalvik.system.NativeStart.main(Native Method)
05-23 20:52:22.795: E/AndroidRuntime(1293): Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
05-23 20:52:22.795: E/AndroidRuntime(1293):     at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:108)
05-23 20:52:22.795: E/AndroidRuntime(1293):     at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:57)
05-23 20:52:22.795: E/AndroidRuntime(1293):     at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)
05-23 20:52:22.795: E/AndroidRuntime(1293):     at com.example.apocalypse.MainActivity.onCreate(MainActivity.java:16)
05-23 20:52:22.795: E/AndroidRuntime(1293):     at android.app.Activity.performCreate(Activity.java:5231)
05-23 20:52:22.795: E/AndroidRuntime(1293):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
05-23 20:52:22.795: E/AndroidRuntime(1293):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
05-23 20:52:22.795: E/AndroidRuntime(1293):     ... 11 more
05-23 20:52:27.725: I/Process(1293): Sending signal. PID: 1293 SIG: 9

1 个答案:

答案 0 :(得分:0)

只需检查Manifest.xml文件中的MainActivity主题即可。它应该是Theme.AppCompat主题(或后代)。