Android Material Design: Failed to find style 'toolbarStyle' in current theme-ThrowExceptions

Exception or error:

I am trying to use the toolbar widget in android 21 with a custom style but I can’t get rid off this error :
Failed to find style 'toolbarStyle' in current theme.

Here is my layout xml file :

    app:theme="@style/AppTheme.Patient" />

Here is the Patient theme :


<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
    <!-- Customize your theme here. -->

<style name="AppTheme.Patient" parent="AppTheme">
    <item name="colorPrimary">@color/patient_primary</item>
    <item name="colorPrimaryDark">@color/patient_primary_dark</item>
    <item name="colorAccent">@color/patient_accent</item>
    <item name="toolbarStyle"></item> <!-- what values to put here -->

I also tried to add toolbarStyle in item in my theme but I don’t know the possible values. Am I missing something?

How to solve:

You can use the style Widget.AppCompat.Toolbar.

<!-- Toolbar styles -->
    <item name="toolbarStyle">@style/Widget.AppCompat.Toolbar</item>


I had the same problem event though my xml was correct.
The solution was to: Set AppCompat theme in the Theme Select Checkbox, see pic.
enter image description here

Leave a Reply

Your email address will not be published. Required fields are marked *