appcompat-v7:25.3.0:AppCompat不支持当前的主题功能:{windowActionBar:false,windowActionBarOverlay:false,. } [英] appcompat-v7:25.3.0 : AppCompat does not support the current theme features: { windowActionBar: false, windowActionBarOverlay: false, . }

查看:234
本文介绍了appcompat-v7:25.3.0:AppCompat不支持当前的主题功能:{windowActionBar:false,windowActionBarOverlay:false,. }的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行时遇到以下错误,并且该活动无法启动.错误显示在setContentView(R.layout.activity_main);,请帮助.

I am getting the following error while running and the activity does not start. The error is showing at setContentView(R.layout.activity_main); Please help.

我正在使用以下库:

compile project(':library')
compile 'com.google.android.gms:play-services-maps:10.2.0'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:design:25.3.0'
compile 'com.parse:parsetwitterutils-android:1.10.5'
compile files('libs/bolts-android-1.2.0-javadoc.jar')
compile files('libs/bolts-android-1.2.0.jar')
compile files('libs/listviewanimations_lib-core-slh_3.1.0.jar')
compile files('libs/listviewanimations_lib-core_3.1.0.jar')
compile files('libs/listviewanimations_lib-manipulation_3.1.0.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/Parse-1.9.1.jar')
compile files('libs/parse-android-1.13.3.jar')
compile files('libs/ParseCrashReporting-1.9.1.jar')
compile files('libs/picasso-2.5.0.jar')
compile files('libs/universal-image-loader-1.9.3.jar')

错误是:

AndroidRuntime:致命异常:主要 流程:com.app.android.hashmap,PID:26336 java.lang.RuntimeException:无法启动活动ComponentInfo {com.app.android.hashmap/com.app.android.hashmap.MainActivity}:java.lang.IllegalArgumentException:AppCompat不支持当前的主题功能:{windowActionBar:false ,windowActionBarOverlay:false,android:windowIsFloating:false,windowActionModeOverlay:false,windowNoTitle:false} 在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416) 在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 在android.app.ActivityThread.-wrap11(ActivityThread.java) 在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1344) 在android.os.Handler.dispatchMessage(Handler.java:102) 在android.os.Looper.loop(Looper.java:148) 在android.app.ActivityThread.main(ActivityThread.java:5417) 在java.lang.reflect.Method.invoke(本机方法) 在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:726) 在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 引起原因:java.lang.IllegalArgumentException:AppCompat不支持当前的主题功能:{windowActionBar:false,windowActionBarOverlay:false,android:windowIsFloating:false,windowActionModeOverlay:false,windowNoTitle:false} 在android.support.v7.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImplV9.java:474) 在android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:328) 在android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:289) 在android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 在com.app.android.hashmap.MainActivity.onCreate(MainActivity.java:49) 在android.app.Activity.performCreate(Activity.java:6237) 在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 在android.app.ActivityThread.-wrap11(ActivityThread.java) 在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1344) 在android.os.Handler.dispatchMessage(Handler.java:102) 在android.os.Looper.loop(Looper.java:148) 在android.app.ActivityThread.main(ActivityThread.java:5417) 在java.lang.reflect.Method.invoke(本机方法) 在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:726) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

AndroidRuntime: FATAL EXCEPTION: main Process: com.app.android.hashmap, PID: 26336 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app.android.hashmap/com.app.android.hashmap.MainActivity}: 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:2416) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) at android.app.ActivityThread.-wrap11(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 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.app.android.hashmap.MainActivity.onCreate(MainActivity.java:49) at android.app.Activity.performCreate(Activity.java:6237) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)  at android.app.ActivityThread.-wrap11(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:5417)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

推荐答案

Android开发人员在引入

Android developers have made AppCompat more restricted about windowNoTitle flag as they were introduces AppCompatDialogs which are highly dependent on windowNoTitle flag - in version of 22.1.0.

因此,要解决您的问题,请使用主题父级-Theme.AppCompat.NoActionBar

如果您的要求不适合此要求,请在需要的地方使用单独的主题-

So to fix your problem use your theme parent to - Theme.AppCompat.NoActionBar

If your requrement doesn't suite that, use separate theme where needed -

例如-

<style name="MyTheme" parent="Theme.AppCompat">
    ...
</style>

<style name="MyTheme.NoActionBar">
    <!-- both your properties are there -->
    <!-- Remove other ones.. i.e. windowActionBarOverlay and all -->
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

参考- Android开发者的博客

这篇关于appcompat-v7:25.3.0:AppCompat不支持当前的主题功能:{windowActionBar:false,windowActionBarOverlay:false,. }的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆