Mindaugas Nakrošis
Mindaugas Nakrošis

Reputation: 120

Change text of android menu item

My menu layout looks like this:

<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/action_change_pin"
    android:title="@string/action_change_pin"
    android:textColor="#000000"
    android:orderInCategory="100"
    app:showAsAction="never" />
<item android:id="@+id/action_logout"
    android:title="@string/action_logout"
    android:orderInCategory="100"
    app:showAsAction="never" />

I want to change these two items' text color to white from black. How can i do that?

Upvotes: 1

Views: 557

Answers (3)

Strider
Strider

Reputation: 4490

I think u need to change the style: try this :

put this in your theme

 <item name="android:itemTextAppearance">@style/myCustomMenuTextApearance</item>

and in your styles.xml:

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

should help u out

Upvotes: 1

Venkatesh
Venkatesh

Reputation: 209

In your theme.xml

<style name="LightTheme" parent="@style/Theme.AppCompat.Light">
    <item name="actionMenuTextColor">#FFF</item>
    <item name="android:actionMenuTextColor">#FFF</item>
</style>

Upvotes: 1

Kostas Drak
Kostas Drak

Reputation: 3260

Try this:

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

Upvotes: 0

Related Questions