In my main theme, I include this:
<item name="android:popupMenuStyle">@style/ListPopupWindow</item>
in styles.xml
:
<style name="ListPopupWindow" parent="@android:style/Widget.Holo.ListPopupWindow">
<item name="android:textColor">@color/bright_foreground_holo_dark</item>
</style>
where bright_foreground_holo_dark
is a light gray (#fff3f3f3
). Yet the text appears as black. The background is a dark gray, as it should be in the dark holo theme.
These definitions are in the android styles.xml source.
<style name="Widget.Holo.ListPopupWindow" parent="Widget.ListPopupWindow">
<item name="android:dropDownSelector">@android:drawable/list_selector_holo_dark</item>
<item name="android:popupBackground">@android:drawable/menu_dropdown_panel_holo_dark</item>
<item name="android:dropDownVerticalOffset">0dip</item>
<item name="android:dropDownHorizontalOffset">0dip</item>
<item name="android:dropDownWidth">wrap_content</item>
</style>
<style name="Widget.ListPopupWindow">
<item name="android:dropDownSelector">@android:drawable/list_selector_background</item>
<item name="android:popupBackground">@android:drawable/spinner_dropdown_background</item>
<item name="android:dropDownVerticalOffset">-10dip</item>
<item name="android:dropDownHorizontalOffset">0dip</item>
<item name="android:dropDownWidth">wrap_content</item>
</style>
<style name="Widget">
<item name="android:textAppearance">?textAppearance</item>
</style>
<style name="TextAppearance">
<item name="android:textColor">?textColorPrimary</item>
<item name="android:textColorHighlight">?textColorHighlight</item>
<item name="android:textColorHint">?textColorHint</item>
<item name="android:textColorLink">?textColorLink</item>
<item name="android:textSize">16sp</item>
<item name="android:textStyle">normal</item>
</style>
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. Step 2 − Add the following code to res/layout/activity_main. xml.
Open the colors. xml file by navigating to the app -> res -> values -> colors. xml. Create a color tag inside the resources tag with a name and set a color with its hex code.
Just go to res/values/styles.edit the xml file to change the color of action bar.
Just in case someone is looking for help,
To change the font color of overflow menu item, your main theme should include
<item name="android:textAppearanceLargePopupMenu">@style/PopupMenuTextAppearance</item>
and in style.xml
<style name="PopupMenuTextAppearance" parent="android:TextAppearance.Large">
<item name="android:textColor">@color/bright_foreground_holo_dark</item>
</style>
choose any parent TextAppearance.Medium
/TextAppearance.Small
depending upon needs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With