Say I have a menu (options_menu.xml) similar to the following:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" >
<item android:id="@+id/action_login"
android:title="Login"
app:showAsAction="always"/>
</menu>
which I inflate into the new Toolbar item
mToolbar.inflateMenu(R.menu.options_home);
This results in something like
Is there a way to change this text color without using an image, changing the rest of the Toolbar text color, or by adding a custom view to the toolbar? Looking for an answer for minSdk 15 (appcompat).
Update:
My relevant style:
<style name="AppTheme" parent="AppTheme.Base">
<item name="actionMenuTextColor">@color/ww_red</item>
</style>
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/red</item>
<item name="colorAccent">@color/theme_accent</item>
<item name="android:textColor">@color/text_dark</item>
<item name="android:colorEdgeEffect">@color/gray</item>
</style>
In your theme file you have to put this :
<style name="AppTheme.ActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
...
<item name="actionMenuTextColor">@color/text_color</item>
...
</style>
and apply this theme to your Toolbar view like this :
<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/main_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:layout_gravity="top"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
android:theme="@style/AppTheme.ActionBar"/>
android:theme="@style/AppTheme.ActionBar" don't forget this line in your toolbar