Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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?

like image 242
Dimitri Avatar asked Nov 17 '14 23:11

Dimitri


2 Answers

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

like image 94
David A Avatar answered Sep 28 '22 19:09

David A


You can use the style Widget.AppCompat.Toolbar.

<!-- Toolbar styles -->     <item name="toolbarStyle">@style/Widget.AppCompat.Toolbar</item> 
like image 28
Rajesh P Avatar answered Sep 28 '22 20:09

Rajesh P