I am attempting to use a Toolbar
in my application and I am running into an issue:
java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_ACTION_BAR and set android:windowActionBar to false in your theme to use a Toolbar instead.
I do not believe that I am requesting Window.FEATURE_ACTION_BAR
anywhere and I am setting the ActionBar
to false. This is my Style.xml:
<resources>
<style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar">
<item name="android:windowActionBarOverlay">true</item>
<item name="android:colorPrimary">@color/primary</item>
<item name="android:colorPrimaryDark">@color/primary_dark</item>
<item name="android:colorAccent">@color/accent</item>
<item name="android:textColor">@color/text</item>
<item name="android:textColorPrimary">@color/text_primary</item>
<item name="android:textColorSecondary">@color/text_secondary</item>
</style>
<style name="ToolbarTheme" parent="android:ThemeOverlay.Material.ActionBar">
<item name="android:windowActionBar">false</item>
</style>
</resources>
and this is my toolbar.xml:
<?xml version="1.0" encoding="utf-8"?>
<Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:theme="@style/ToolbarTheme">
</Toolbar>
and in my layouts I am doing <include layout="@layout/toolbar" />
and then setActionBar(toolbar)
in my onCreate()
. I have seen multiple threads about this but none solve my issue. I should also note I am only supporting 5.0 so I am not using appcompat