2

In my android application the text color of a sub menu item is displayed different on Android 4 (API level <=20) than Android 5.

Android 4

Submenu on Android 4

Android 5

Submenu on Android 5

My theme looks like the following:

<style name="Theme.Mytheme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
    <item name="android:actionBarItemBackground">@drawable/selectable_background_mytheme</item>
    <item name="android:popupMenuStyle">@style/PopupMenu.Mytheme</item>
    <item name="android:actionBarTabStyle">@style/ActionBarTabStyle.Mytheme</item>
    <item name="android:actionDropDownStyle">@style/DropDownNav.Mytheme</item>
    <item name="android:actionBarStyle">@style/ActionBar.Solid.Mytheme</item>
    <item name="android:actionModeBackground">@drawable/cab_background_top_mytheme</item>
    <item name="android:actionModeSplitBackground">@drawable/cab_background_bottom_mytheme</item>
    <item name="android:actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Mytheme</item>
    <item name="android:windowBackground">@drawable/app_background</item>
    <item name="android:actionMenuTextColor">@android:color/white</item>

    <!-- Light.DarkActionBar specific -->
    <item name="android:actionBarWidgetTheme">@style/Theme.Mytheme.Widget</item>

    <!-- Widget styles -->
    <item name="android:editTextBackground">@drawable/mytheme_edit_text_holo_light</item>
    <item name="android:textColorHighlight">#993e74b4</item>
    <item name="android:textSelectHandleLeft">@drawable/mytheme_text_select_handle_left</item>
    <item name="android:textSelectHandleRight">@drawable/mytheme_text_select_handle_right</item>
    <item name="android:textSelectHandle">@drawable/mytheme_text_select_handle_middle</item>
    <item name="android:listChoiceIndicatorMultiple">@drawable/mytheme_btn_check_holo_light</item>
    <item name="android:listChoiceIndicatorSingle">@drawable/mytheme_btn_radio_holo_light</item>
    <item name="android:buttonStyle">@style/ButtonMytheme</item>
    <item name="android:imageButtonStyle">@style/ImageButtonMytheme</item>
    <item name="android:dropDownSpinnerStyle">@style/SpinnerMytheme</item>
    <item name="android:progressBarStyleHorizontal">@style/ProgressBarMytheme</item>
    <item name="android:listChoiceBackgroundIndicator">@drawable/mytheme_list_selector_holo_light</item>
    <item name="android:activatedBackgroundIndicator">@drawable/mytheme_activated_background_holo_light</item>
</style>

<style name="ActionBar.Solid.Mytheme" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
    <item name="android:background">@drawable/ab_solid_mytheme</item>
    <item name="android:backgroundStacked">@drawable/ab_stacked_solid_mytheme</item>
    <item name="android:backgroundSplit">@drawable/ab_bottom_solid_mytheme</item>
    <item name="android:progressBarStyle">@style/ProgressBar.Mytheme</item>
</style>

<style name="ActionBar.Transparent.Mytheme" parent="@android:style/Widget.Holo.ActionBar">
    <item name="android:background">@drawable/ab_transparent_mytheme</item>
    <item name="android:progressBarStyle">@style/ProgressBar.Mytheme</item>
</style>

<style name="PopupMenu.Mytheme" parent="@android:style/Widget.Holo.ListPopupWindow">
    <item name="android:popupBackground">@drawable/menu_dropdown_panel_mytheme</item>
</style>

<style name="DropDownListView.Mytheme" parent="@android:style/Widget.Holo.ListView.DropDown">
    <item name="android:listSelector">@drawable/selectable_background_mytheme</item>
    <item name="android:textColor">@android:color/white</item>
</style>

<style name="ActionBarTabStyle.Mytheme" parent="@android:style/Widget.Holo.ActionBar.TabView">
    <item name="android:background">@drawable/tab_indicator_ab_mytheme</item>
</style>

<style name="DropDownNav.Mytheme" parent="@android:style/Widget.Holo.Spinner">
    <item name="android:background">@drawable/spinner_background_ab_mytheme</item>
    <item name="android:popupBackground">@drawable/menu_dropdown_panel_mytheme</item>
    <item name="android:dropDownSelector">@drawable/selectable_background_mytheme</item>
</style>

<style name="ProgressBar.Mytheme" parent="@android:style/Widget.Holo.ProgressBar.Horizontal">
    <item name="android:progressDrawable">@drawable/progress_horizontal_mytheme</item>
</style>

<style name="ActionButton.CloseMode.Mytheme" parent="@android:style/Widget.Holo.ActionButton.CloseMode">
    <item name="android:background">@drawable/btn_cab_done_mytheme</item>
</style>

<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Mytheme.Widget" parent="@android:style/Theme.Holo">
    <item name="android:popupMenuStyle">@style/PopupMenu.Mytheme</item>
    <item name="android:dropDownListViewStyle">@style/DropDownListView.Mytheme</item>
</style>

What has changed from Android 4 to Android 5 ? What should I add on my theme/style so that I can achieve the same text color on both versions ?

antoniom
  • 3,143
  • 1
  • 37
  • 53
  • 1
    http://stackoverflow.com/a/24653532/1564284 check this answer, i think it might help you – Chris K. Apr 16 '15 at 10:16
  • @ChrisK. Thank you! However, this solves half of the problem. Defining android:itemTextAppearance made the text color white, but the radio button images are still grey! – antoniom Apr 16 '15 at 10:36
  • The overflow menu in Light.DarkActionBar uses a Light theme overlay by default. You can change this by setting `android:popupTheme` to null in your app theme. – alanv Apr 16 '15 at 19:59

0 Answers0