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

29,596

Solution 1

You can use the style Widget.AppCompat.Toolbar.

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

Solution 2

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

Share:
29,596
Dimitri
Author by

Dimitri

Updated on July 09, 2022

Comments

  • Dimitri
    Dimitri almost 2 years

    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 :

     <android.support.v7.widget.Toolbar
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/patient_toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:theme="@style/AppTheme.Patient" />
    

    Here is the Patient theme :

    <resources>
    
    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light">
        <!-- Customize your theme here. -->
    </style>
    
    <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 -->
    </style>
    

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