android - Overflow Menu textColor with AppCompat (using Hardware Menu-Key) -
i'm facing issue on devices separate menu key (like samsung onces). in activities textcolor of overflow menu items white when opened via menu-key. opening overflow via 3 dots textcolor black - should be.
following screenshot visualizes issue. on left side fine, overflow has been opened via 3 dots. on right side menu has been opened via menu-key:

my theme:
<style name="appthemetoolbar" parent="theme.appcompat.light.noactionbar"> <item name="colorprimary">@color/primary_color</item> <item name="colorprimarydark">@color/primary_color_dark</item> <item name="coloraccent">@color/accent_color</item> <item name="android:textcolorprimary">@android:color/white</item> <item name="android:textcolorsecondary">@android:color/white</item> <item name="windowactionmodeoverlay">true</item> <item name="actionmodebackground">@color/action_mode_color</item> <item name="actionbarpopuptheme">@style/themeoverlay.appcompat.light</item> </style> note: i'm using exact same theme in multiple activities though in 3 out of 5 fine. that's totally mind boggling , doesn't make sense.
so question is: how can fix , why textcolor in activities black , in others white (while they're using same theme)?
what i've tried (found in other similar posts):
- setting
panelbackground. this works, unfortunately isn't solution me since textcolor switches @ between black , white - there's no background color set. - what didn't work:
android:paneltextappearancetextappearancesmallpopupmenutextappearancelargepopupmenupopupmenustyleandroid:actionmenutextcolor&actionmenutextcolor
- i don't wanna use spannablestrings - approach seems hacky
finally found solution!
<style name="apptheme" parent="theme.appcompat.light.noactionbar"> <item name="actionbarpopuptheme">@style/hardwareoptionmenu</item> </style> <style name="hardwareoptionmenu" parent="themeoverlay.appcompat.dark"> <item name="android:textcolorsecondary">@color/white</item> <item name="android:colorbackground">@color/black</item> </style>
Comments
Post a Comment