Android Menu Text Color Change

I am trying Material theme and changing the background and text color of Menu and items. Using the below style it works fine on the Toolbar, but the menu pop up while pressing device menu button shows no change in text color though the background got changed. Please help to change the text color as mentioned.

<resources>

<style name="MyMaterialTheme" parent="MyMaterialTheme.Base">

</style>

<style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:textColorPrimary">@color/accent</item>
    <item name="android:textColorSecondary">@color/accent</item>
    <item name="android:textColorHint">@color/accent</item>

    <!-- Menu Items -->
    <item name="android:textColor">@color/accent</item>
    <item name="android:actionMenuTextColor">@color/accent</item>
    <item name="actionMenuTextColor">@color/accent</item>
    <item name="actionBarStyle">@style/MyActionBar</item>
    <item name="android:itemBackground">@color/colorPrimaryDark</item>
    <item name="android:itemTextAppearance">@style/MyActionBar.MenuTextStyle</item>

    <!-- Menu Items -->
</style>



<style name="MyActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
    <item name="background">@color/colorPrimaryDark</item>
    <item name="titleTextStyle">@style/MyActionBarTitle</item>
    <item name="actionMenuTextColor">@color/accent</item>

</style>
<style name="MyActionBarTitle" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
    <item name="android:textColor">@color/accent</item>
    <item name="android:actionMenuTextColor">@color/accent</item>
    <item name="actionMenuTextColor">@color/accent</item>

</style>
<style name="MyActionBar.MenuTextStyle">
    <item name="android:textColor">@color/accent</item>
    <item name="android:textStyle">bold</item>
    <item name="android:actionMenuTextColor">@color/accent</item>
    <item name="actionMenuTextColor">@color/accent</item>
</style>

try this create this theme

<style name="TextAppearance" parent="@style/Theme.Sherlock.Light">
   <item name="actionMenuTextColor">@color/white</item>
   <item name="android:actionMenuTextColor">@color/white</item>
</style>

than apply this theme in your Activity theme like this

<style name="your_theme" parent="your_parent">
  <item name="android:itemTextAppearance">@style/TextAppearance</item>
</style>

or try this

 @Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.your_menu, menu);

    int positionOfMenuItem = 0; 
    MenuItem item = menu.getItem(positionOfMenuItem);
    SpannableString s = new SpannableString("My red MenuItem");
    s.setSpan(new ForegroundColorSpan(Color.RED), 0, s.length(), 0);
    item.setTitle(s);
}

how to change actionbar's menu item text color in material design , <item name="android:textColorPrimary">yourColor</item>. Above code changes the text color of the menu action items for API >= v21. This example demonstrates how do I change the text color of the menu item in android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.

One simple line in your theme :)

<item name="android:actionMenuTextColor">@color/your_color</item>

How to change the text color of Menu item in Android?, This example demonstrates how do I change the text color of the menu item in android.Step 1 − Create a new project in Android Studio, go to� Android’s new Toolbar, which replaces ActionBar (with some awkward code), makes it easier to change the title text color and the color of the menu overflow icon (and the Up/Back icon). So now I finally have dark text and icons on my light background in the dark theme:

Add one simple line in your theme .I hope this will solve your problem.

  <item name="android:textColor">@color/button_color</item>

enjoy..

Changing text color of a MenuItem programmatically (Android , above solution is work only for API >24, is any way to change menu item title color API<=24. i found one solution but not want to use because for that we need to� Step 1. Set a text color in XML and Java – android:textColor and setTextColor() All we have to do to set text color in XML is to add one more attribute called android:textColor to TextView tag. As its value we could put #RGB, #ARGB, #RRGGBB, #AARRGGBB color value or reference to color saved in colors.xml (all is explained in the appendix

You can change the color of the overflow menu background by adding a new style in style.xml.

<style name="OverflowMenu"
parent="@android:style/Theme.Holo">
<item name="android:popupMenuStyle">@style/MyOverflowMenu</item>
<item name="android:itemTextAppearance">@style/TextAppearance</item>
</style>
<style name="MyOverflowMenu" 
parent="@android:style/Widget.Holo.ListPopupWindow">
<item name="android:popupBackground">@color/your_color</item> 
</style>
<style name="TextAppearance">
<item name="android:textColor">@color/your_color</item>
</style>

menuitem How to change the Text color of Menu item in Android , menuitem How to change the Text color of Menu item in Android? @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater. inflate(� In this article, you will learn how to change the colour of the Action Bar in an Android App.. There are two ways to change color. By changing styles.xml file:

 // note if you want to style popup menu in toolbar    
 step 1-- Add your theme in toolbar 

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        app:popupTheme="@style/MyPopupTheme" />

    step 2-- add style in styles.xml

    <style name="MyPopupTheme" parent="ThemeOverlay.AppCompat.Dark">
        <item name="android:colorControlActivated">@color/red </item>
        <item name="android:colorControlHighlight">@color/red</item>
        <item name="android:colorControlNormal">@color/yellow</item>
        <item name="android:textColorPrimary">@color/yellow</item>
    </style>


// note if you want to style menu text color  in toolbar itself
     <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:theme="@style/Mytoolbartheme"/    /> 


    <style name="Mytoolbartheme" parent="Theme.AppCompat.Light.DarkActionBar">

        <item name="actionMenuTextColor">@color/text_color</item>

    </style>

    // if you use android x then toolbar is
       <androidx.appcompat.widget.Toolbar
                android:layout_width="match_parent"
                android:id="@+id/toolbar"
                app:titleTextColor="@color/white"

                app:popupTheme="@style/MyPopupTheme"
                android:background="@color/colorsplash"
                android:layout_height="wrap_content">

        </androidx.appcompat.widget.Toolbar>

How to change the Text color of Menu item in Android?, android:textColor is the color for all other text including the menu. Finally set the theme to the Toolbar <android.support.v7.widget.Toolbar xmlns:android� 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:

Android: Changing the Toolbar's text color and overflow icon color , That toolbar theme specifies a textColorPrimary and textColorSecondary to change the color of the title text and of the menu overflow button. You� I'd like to change the background color of the option (overflow) menu in Android 4.2. I have tried all the methods but it is still showing the default color set by the theme. I used the following c

Change menu item background color and text color: Android , You have to change menu background and text color by finding out the layout resources forcefully and then apply the color to the resources. This is custom code� The SearchView element doesn't have any properties for changing the text color. The default text color is black and doesn't work on our dark background. Is there a way to change the color of the text

How to change the Text color of Menu item in Android?, android change menu item icon color programmatically change menu item background color android toolbar menu text color android android context menu � People love customization, and if there’s one thing Android is really good at, that’s it. And Google’s Messenger is no exception. Every conversation has a specific color, but you can change the color of any conversation through its menu.

Comments
  • If any of given answers solved your question, please accept it for future user reference.
  • Hi Nilesh, thanks for your suggestion, but can it be done without Sherlock ? I tried importing it into my existing project and resulted into many compilation errors
  • @BharatKumar chek updated ans try to set programatically
  • Hi Nilesh, your second suggestion works. Thanks. Even though i was looking for some solutions from styles/themes, but this solves my problem and so i am accepting your answer for now.
  • Perfect answer, it's Working
  • @NileshRathod you just saved my life wit the "or try this" option!!! There is a bug in every SDK lower than the new API 29: for "android:secondaryTextColor", Android does not pull the color value from values-night folder if you implement dark mode. I need that attribute to color Menu items which use "secondaryTextColor". I could set the color programmatically like this, gold !!
  • Hi Prashanna, its already in my theme bt has no change on color..pls check the code i had updated along with question