androidandroid-menu

Change textcolor of menu item


I want to change textcolor of menu items. below is my xml layout for menu -

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
    android:id="@+id/a_More"
    android:icon="@drawable/icon_menu_titleview"
    android:showAsAction="always">
    <menu>
        <item
            android:id="@+id/action_titleview"
            android:icon="@drawable/icon_menu_titleview"
            android:showAsAction="never"
            android:title="@string/title_view"/>
        <item
            android:id="@+id/action_listview"
            android:icon="@drawable/icon_menu_list_view"
            android:showAsAction="never"
            android:title="@string/list_view"/>
        <item
            android:id="@+id/action_magazineview"
            android:icon="@drawable/icon_menu_magazine_view"
            android:showAsAction="never"
            android:title="@string/magazine_view"/>
        <item
            android:id="@+id/action_cardview"
            android:icon="@drawable/icon_menu_card_view"
            android:showAsAction="never"
            android:title="@string/card_view"/>
    </menu>
</item>
</menu>

I don't know which property to use. Thanks in advance


Solution

  • <item name="android:itemTextAppearance">@style/myCustomMenuTextApearance</item>
    
    
    <style name="myCustomMenuTextApearance" parent="@android:style/TextAppearance.Widget.IconMenu.Item">
        <item name="android:textColor">@android:color/primary_text_dark</item>
    </style>
    

    have a look this