I have a menu that is inflated on to a toolbar in 3 different Activities. One of the Activities has a Overflow menu with one Action behind the Overflow. I can change the background color of the Action. I can not change the text color of the text associated with the Action. Please do not down vote I have looked at and tried all 136 similar posted questions. Here is the styles code and menu code below.
<resources>
<!-- Base application theme. -->
<!-- parent="Theme.AppCompat.NoActionBar"> -->
<!-- Line of CODE ABOVE gives WHITE color to items in ToolBar -->
<!-- Line of CODE BELOW gives BLACk color to items in ToolBar -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:itemBackground">@color/color_Red</item>
<item name="actionMenuTextColor">@style/MyActionBarTitleText</item>
</style>
<style name="MyActionBarTitleText" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/color_Yellow</item>
</style>
Menu Code
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".MainActivity">
<item
android:id="@+id/action_ReSetPW"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never"
android:visible="true"/>
As a side note I also could not change the Title Text Color based on some parameter. I would like to know how to set or change the text color? After some trial and ERROR I am posting a styles code with comments for a solution solution code below
<resources>
<!-- Base application theme. -->
<!-- parent="Theme.AppCompat.NoActionBar"> -->
<!-- Line of CODE ABOVE gives WHITE color to items in ToolBar -->
<!-- Line of CODE BELOW gives BLACk color to items in ToolBar -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:itemBackground">@color/color_Red</item>
<!--The line of CODE above styles the action background color -->
</style>
<style name="Toolbar.TitleText" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
<item name="android:textSize">21sp</item>
<item name="android:textStyle">italic</item>
</style>
<!--ADD THIS TO THE XML that defines the widget ToolBar android:theme="@style/ToolbarTheme" -->
<!--the line of CODE above tells the ToolBar where to find the style to use -->
<!--Code below will make the Overflow three dots Yellow and the text of the Action Yellow -->
<style name="ToolbarTheme" parent="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:textColorPrimary">@color/color_Yellow</item>
</style>
It seems part of the solution is to call the style from the toolbar.xml