Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/198.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android 4.4.2上的崩溃:此活动已经有一个由窗口装饰提供的操作栏_Android_Android Actionbar_Android Toolbar_Android Theme - Fatal编程技术网

android 4.4.2上的崩溃:此活动已经有一个由窗口装饰提供的操作栏

android 4.4.2上的崩溃:此活动已经有一个由窗口装饰提供的操作栏,android,android-actionbar,android-toolbar,android-theme,Android,Android Actionbar,Android Toolbar,Android Theme,当我在android 4.4.2中运行应用程序时,我的应用程序因此错误而崩溃: Caused by: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme

当我在android 4.4.2中运行应用程序时,我的应用程序因此错误而崩溃:

Caused by: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.
我正在使用一个工具栏,我正在将基本主题设置为.NoActionBar,这样它就可以正常工作了

这是我的默认theme.xml:

 <style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
</style>


...
尝试使用此样式

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>

    <item name="android:windowContentTransitions">true</item>
</style>

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

在您的活动标记中

您确定您的活动没有使用清单中声明的其他主题吗?不,在清单中,我只是将应用程序的主题设置为AppTheme.Base的子项。刚刚尝试,但仍然无法工作。。。不知道现在该怎么办,你们还需要什么信息?
 <style name="AppTheme.Mezzo" parent="AppTheme.Base">
 ...
 </style>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>

    <item name="android:windowContentTransitions">true</item>
</style>

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>
 android:theme="@style/AppTheme.NoActionBar"