Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change actionbar's menu item text color in material design

I'm trying to update my notepad app to use Material Design, even on older devices.

What i did so far:

  1. add library appcompat_v7 to my project, to support Material Design on older devices
  2. modify theme in AndroidManifest, adding android:theme="@style/Theme.NoteItTheme" to <application ... ></application> attributes
  3. creating the theme in /res/values/themes.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <resources xmlns:android="http://schemas.android.com/apk/res/android">
       <style name="Theme.NoteItTheme" parent="Theme.AppCompat.Light">
        <!-- Here we setting appcompat’s actionBarStyle -->
        <!-- <item name="actionBarStyle">@style/MyActionBarStyle</item> --> 
    
        <!-- ...and here we setting appcompat’s color theming attrs -->
        <item name="colorPrimary">@color/primary</item>
        <item name="colorPrimaryDark">@color/primary_dark</item>
        <item name="android:textColorPrimary">@color/text</item>
        <item name="colorAccent">@color/ui</item>
    
        <!-- The rest of your attributes -->
    </style>
    

The problem:

As you can better see here:

the problem

when i expand the actionbar's menu, text color and background color are very similar. I hadn't this problem before, how do i change just the items text color?

like image 891
le0m Avatar asked Feb 01 '15 20:02

le0m


2 Answers

<item name="android:textColorPrimary">yourColor</item>

Above code changes the text color of the menu action items for API >= v21.

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

Above is the code for API < v21

Some tutorials:

Changing toolbar's text color and overflow icon color

Appcompat v21 Pre-Lollipop devices

like image 76
JavierSegoviaCordoba Avatar answered Sep 29 '22 01:09

JavierSegoviaCordoba


Below worked for me

<item name="actionMenuTextColor">yourColor</item>
<item name="android:actionMenuTextColor">yourColor</item>
like image 28
sanjeev barnwal Avatar answered Sep 29 '22 01:09

sanjeev barnwal