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

Dimitri picture Dimitri · Nov 18, 2014 · Viewed 29.1k times · Source

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?

Answer

David A picture David A · May 3, 2015

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