AppCompat does not support the current theme features

来源:互联网 发布:yy淘宝兼职刷信誉 编辑:程序博客网 时间:2024/05/17 07:40

报错日志log:

04-28 10:55:57.972 19383-19383/? E/Zygote: MountEmulatedStorage()04-28 10:55:57.972 19383-19383/? E/Zygote: v204-28 10:55:57.982 19383-19383/? E/SELinux: [DEBUG] get_category: variable seinfo: default sensitivity: NULL, cateogry: NULL04-28 10:56:02.362 19383-19383/com.xiaolijuan.swiperefreshlayoutdome E/MotionRecognitionManager: mSContextService = null04-28 10:56:02.362 19383-19383/com.xiaolijuan.swiperefreshlayoutdome E/MotionRecognitionManager: motionService = null04-28 10:56:12.862 19383-19383/com.xiaolijuan.swiperefreshlayoutdome E/AndroidRuntime: FATAL EXCEPTION: main                                                                                       Process: com.xiaolijuan.swiperefreshlayoutdome, PID: 19383                                                                                       java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xiaolijuan.swiperefreshlayoutdome/com.william.swiperefreshlayoutdemo.toolbar.ToolBarActivity}: java.lang.IllegalArgumentException: AppCompat does not support the current theme features: { windowActionBar: false, windowActionBarOverlay: false, android:windowIsFloating: false, windowActionModeOverlay: false, windowNoTitle: false }                                                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3168)                                                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3278)                                                                                           at android.app.ActivityThread.access$1000(ActivityThread.java:211)                                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1705)                                                                                           at android.os.Handler.dispatchMessage(Handler.java:102)                                                                                           at android.os.Looper.loop(Looper.java:145)                                                                                           at android.app.ActivityThread.main(ActivityThread.java:6918)                                                                                           at java.lang.reflect.Method.invoke(Native Method)                                                                                           at java.lang.reflect.Method.invoke(Method.java:372)                                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)                                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)                                                                                        Caused by: java.lang.IllegalArgumentException: AppCompat does not support the current theme features: { windowActionBar: false, windowActionBarOverlay: false, android:windowIsFloating: false, windowActionModeOverlay: false, windowNoTitle: false }                                                                                           at android.support.v7.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImplV9.java:474)                                                                                           at android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:328)                                                                                           at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:289)                                                                                           at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)                                                                                           at com.william.swiperefreshlayoutdemo.toolbar.ToolBarActivity.onCreate(ToolBarActivity.java:14)                                                                                           at android.app.Activity.performCreate(Activity.java:6609)                                                                                           at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1134)                                                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3121)                                                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3278)                                                                                            at android.app.ActivityThread.access$1000(ActivityThread.java:211)                                                                                            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1705)                                                                                            at android.os.Handler.dispatchMessage(Handler.java:102)                                                                                            at android.os.Looper.loop(Looper.java:145)                                                                                            at android.app.ActivityThread.main(ActivityThread.java:6918)                                                                                            at java.lang.reflect.Method.invoke(Native Method)                                                                                            at java.lang.reflect.Method.invoke(Method.java:372)                                                                                            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)                                                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199) 



解决方法:

http://stackoverflow.com/questions/29790070/upgraded-to-appcompat-v22-1-0-and-now-getting-illegalargumentexception-appcompa


步骤:

values 下 style.xml

设置如下:

    <!-- Base application theme. -->    <style name="AppTheme" parent="AppTheme.Base">    </style>    <!--这里不能用 <item name="windowActionBar">false</item>  取而代之的是继承Theme.AppCompat.Light.NoActionBar -->    <style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">        <item name="android:windowNoTitle">true</item>    </style>

values-v21 下 style.xml

<resources><style name="AppTheme" parent="AppTheme.Base"/></resources>







0 0