android开发期间应用程序主题崩溃
我有个问题。当我将主题更改为Theme.Black.NoTitleBar.Fullscreen时,我不知道为什么我的应用程序不能在模拟器或Note 3上运行。当我试着运行它的时候。仿真器使用强制关闭按钮显示和错误消息。我卡住了,请帮忙!多谢各位 这些是在我的日志中抛出的错误android开发期间应用程序主题崩溃,android,android-layout,Android,Android Layout,我有个问题。当我将主题更改为Theme.Black.NoTitleBar.Fullscreen时,我不知道为什么我的应用程序不能在模拟器或Note 3上运行。当我试着运行它的时候。仿真器使用强制关闭按钮显示和错误消息。我卡住了,请帮忙!多谢各位 这些是在我的日志中抛出的错误 03-27 07:01:34.127: D/AndroidRuntime(2619): Shutting down VM 03-27 07:01:34.127: W/dalvikvm(2619): threadid=1: t
03-27 07:01:34.127: D/AndroidRuntime(2619): Shutting down VM
03-27 07:01:34.127: W/dalvikvm(2619): threadid=1: thread exiting with uncaught exception (group=0xa4d05b20)
03-27 07:01:34.127: E/AndroidRuntime(2619): FATAL EXCEPTION: main
03-27 07:01:34.127: E/AndroidRuntime(2619): Process: com.example.crystalball, PID: 2619
03-27 07:01:34.127: E/AndroidRuntime(2619): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.crystalball/com.example.crystalball.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
03-27 07:01:34.127: E/AndroidRuntime(2619): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
03-27 07:01:34.127: E/AndroidRuntime(2619): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
03-27 07:01:34.127: E/AndroidRuntime(2619): at android.app.ActivityThread.access$800(ActivityThread.java:135)
03-27 07:01:34.127: E/AndroidRuntime(2619): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
03-27 07:01:34.127: E/AndroidRuntime(2619): at android.os.Handler.dispatchMessage(Handler.java:102)
03-27 07:01:34.127: E/AndroidRuntime(2619): at android.os.Looper.loop(Looper.java:136)
03-27 07:01:34.127: E/AndroidRuntime(2619): at android.app.ActivityThread.main(ActivityThread.java:5017)
03-27 07:01:34.127: E/AndroidRuntime(2619): at java.lang.reflect.Method.invokeNative(Native Method)
03-27 07:01:34.127: E/AndroidRuntime(2619): at java.lang.reflect.Method.invoke(Method.java:515)
03-27 07:01:34.127: E/AndroidRuntime(2619): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-27 07:01:34.127: E/AndroidRuntime(2619): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-27 07:01:34.127: E/AndroidRuntime(2619): at dalvik.system.NativeStart.main(Native Method)
03-27 07:01:34.127: E/AndroidRuntime(2619): Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
03-27 07:01:34.127: E/AndroidRuntime(2619): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:111)
03-27 07:01:34.127: E/AndroidRuntime(2619): at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58)
03-27 07:01:34.127: E/AndroidRuntime(2619): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)
03-27 07:01:34.127: E/AndroidRuntime(2619): at com.example.crystalball.MainActivity.onCreate(MainActivity.java:19)
03-27 07:01:34.127: E/AndroidRuntime(2619): at android.app.Activity.performCreate(Activity.java:5231)
03-27 07:01:34.127: E/AndroidRuntime(2619): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
03-27 07:01:34.127: E/AndroidRuntime(2619): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
03-27 07:01:34.127: E/AndroidRuntime(2619): ... 11 more
日志上写着:
You need to use a Theme.AppCompat theme (or descendant) with this activity.
03-27 07:01:34.127: E/AndroidRuntime(2619): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
说明:
The reason you are having this problem is because the activity you are trying
to apply the theme to is extending ActionBarActivity which
requires the AppCompat theme to be applied.
Change the parent of the actual java code to be just plain Activity and
you should be able to leave the theme on it.
选自
希望有帮助