title: Styling the android.support.v7.widget.Toolbar with AppCompat from styles.xml
body: <p>I've got a problem with styling a Toolbar inside a CoordinatorLayout / AppBarLayout from my <code>styles.xml</code> file in combination with using AppCompat from the 23.1.1 support libraries.</p>
  
  <p><strong>The problem I want to solve:</strong> My activity is used from different app projects, all of which use <code>Theme.AppCompat.Light.NoActionBar</code>. Some apps have light primary colors where everything is fine. Some, however, have dark primary colors that would require setting <code>android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"</code> on the Toolbar in the activity's layout file - which I cannot do as the same code and resource files are used by the other apps as well.</p>
  
  <p><strong>EDIT: I think I got this solved now. Keeping the <code>styles.xml</code> as it was, in the Activity I now inherit the actionBarTheme as follows (got the idea from reading <a href="http://developer.android.com/reference/android/R.styleable.html#Theme_toolbarStyle" rel="nofollow noreferrer">http://developer.android.com/reference/android/R.styleable.html#Theme_toolbarStyle</a>):</strong></p>
  
  <pre><code>&lt;android.support.v7.widget.Toolbar
      android:id="@+id/webview_toolbar"
      android:fitsSystemWindows="true"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:theme="?attr/actionBarTheme"/&gt;
  </code></pre>
  
  <p>See the following related questions and blog posts:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/26503149/how-do-i-style-appcompat-v7-toolbar-like-theme-appcompat-light-darkactionbar">How do I style appcompat-v7 Toolbar like Theme.AppCompat.Light.DarkActionBar?</a></li>
  <li><a href="https://chris.banes.me/2014/11/12/theme-vs-style/" rel="nofollow noreferrer">https://chris.banes.me/2014/11/12/theme-vs-style/</a></li>
  <li><a href="https://stackoverflow.com/questions/26503149/how-do-i-style-appcompat-v7-toolbar-like-theme-appcompat-light-darkactionbar">How do I style appcompat-v7 Toolbar like Theme.AppCompat.Light.DarkActionBar?</a></li>
  <li><a href="https://stackoverflow.com/questions/27238433/when-should-one-use-theme-appcompat-vs-themeoverlay-appcompat">When should one use Theme.AppCompat vs ThemeOverlay.AppCompat?</a></li>
  </ul>
  
  <p>After reading all of the above, I tried to solve my problem by deriving an app theme from <code>Theme.AppCompat.Light.DarkActionBar</code> (instead of *.NoActionBar) in those apps that have dark primary colors and applying all styles that let the action bar go away. Out of despair, I have even tried to set actionBarTheme and actionBarStyle.</p>
  
  <p>My app has a <code>styles.xml</code> file that looks like this:</p>
  
  <pre><code>&lt;style name="MyTheme" parent="Theme.AppCompat.Light.DarkActionBar"&gt;
      &lt;item name="colorPrimaryDark"&gt;@color/myDarkRed&lt;/item&gt;
      &lt;item name="colorPrimary"&gt;@color/myRed&lt;/item&gt;
      &lt;item name="colorAccent"&gt;@color/myOrange&lt;/item&gt;
      &lt;item name="windowActionBar"&gt;false&lt;/item&gt;
      &lt;item name="windowNoTitle"&gt;true&lt;/item&gt;
      &lt;item name="actionBarTheme"&gt;@style/ThemeOverlay.AppCompat.Dark.ActionBar&lt;/item&gt;
      &lt;item name="actionBarStyle"&gt;@style/ThemeOverlay.AppCompat.Dark.ActionBar&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p>My activity (derived from <code>AppCompatActivity</code>) has a <code>layout.xml</code> that looks like this:</p>
  
  <pre><code>&lt;android.support.v7.widget.Toolbar
      android:id="@+id/webview_toolbar"
      android:fitsSystemWindows="true"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"/&gt;
  </code></pre>
  
  <p>Unfortunately, my Activity still has dark text color on the toolbar. What am I doing wrong?</p>