ScottF ScottF - 1 month ago 20
Android Question

Android menu item text color in theme

I am designing a new theme for my android app using Android Studio Theme editor.

I have not been able to change the text color of the options menu text color.

I have since tried editing the xmls and nothing has worked to change the option items menu.

I have used the following lines in all my styles.xml with no changes...None of the lines with the word text in them have any effect on the menu item text color.

<style name="AppBaseTheme" parent="android:Theme.Material.Light">
<item name="android:colorBackground">@color/background</item>
<item name="android:colorAccent">@color/accent</item>
<item name="android:colorPrimary">@color/accent</item>
<item name="android:colorForeground">@color/common_signin_btn_dark_text_pressed</item>
<item name="android:textColorPrimary">@color/text_color_primary</item>
<item name="android:textColorSecondary">@color/text_color_secondary</item>
<item name="android:textColorTertiary">@color/text_color_secondary</item>
<item name="android:textColorSecondaryInverse">@color/text_color_inverse</item>
<item name="android:colorPrimaryDark">@color/background</item>
<item name="android:textColor">@color/text_color_primary</item>
</style>


The entire application code base can be viewed here...

Answer

Add this to your custom theme:

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

And then create a new style:

  <style name="MenuItemTextAppearance">
    <item name="android:textColor">#000</item> // replace this value with your desired menu item color.
  </style>
Comments