I am testing the new Appcompat 21 Material Design design features. Therefore, I created a toolbar as follows:
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/activity_my_toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" android:background="?attr/colorPrimary" app:theme="@style/ThemeOverlay.AppCompat.ActionBar"/>
and included it in my main layout file.
Then I set it as supportActionBar as follows:
Toolbar toolBar = (Toolbar)findViewById(R.id.activity_my_toolbar); setSupportActionBar(toolBar);
This works, but for some reason I cannot figure out how to customize the toolbar. It is gray, and the text on it is black. How to change the background color and text?
I followed the instructions below:
http://android-developers.blogspot.de/2014/10/appcompat-v21-material-design-for-pre.html
What did I observe the color change?
<style name="AppTheme" parent="Theme.AppCompat.Light"> <item name="android:windowActionBar" tools:ignore="NewApi">false</item> <item name="windowActionBar">false</item> </style>
EDIT
I managed to change the background color by adding these lines of code to the theme:
<item name="colorPrimary">@color/actionbar</item> <item name="colorPrimaryDark">@color/actionbar_dark</item>
But they will not affect the color of the text. What am I missing? Instead of black text and a black menu button, I prefer white text and white menu buttons:

android android-actionbar appcompat android-actionbar-compat android-toolbar
user2410644 Oct 24 '14 at 19:31 2014-10-24 19:31
source share