Lollipop: unwanted light menu on DarkActionBar
I have a very simple application with DarkActionBar.
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
</style>
I am now testing it on Android Lollipop. The action bar is dark, but the popup is light. This does not apply to previous versions of Android.
I tried this but the effect was not what I wanted (dark text on dark background):
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 21 theme customizations can go here. -->
<!-- Will result in dark PopupMenu, but with dark text color (hard to read) -->
<item name="android:popupMenuStyle">@android:style/Widget.Holo.PopupMenu</item>
</style>
This is mistake? How to change?
+3
source to share
1 answer
Finally:
<!--
Base application theme for API 21+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v21/styles.xml on API 21+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 21 theme customizations can go here. -->
<item name="android:popupMenuStyle">@style/MyPopupMenu</item>
<item name="android:textAppearanceLargePopupMenu">@style/myPopupMenuTextAppearanceLarge</item>
<item name="android:textAppearanceSmallPopupMenu">@style/myPopupMenuTextAppearanceSmall</item>
</style>
<style name="myPopupMenuTextAppearanceSmall" parent="@style/TextAppearance.AppCompat.Light.Widget.PopupMenu.Small">
<item name="android:textColor">#F3F3F3</item>
</style>
<style name="myPopupMenuTextAppearanceLarge" parent="@style/TextAppearance.AppCompat.Light.Widget.PopupMenu.Large">
<item name="android:textColor">#F3F3F3</item>
</style>
<!-- style the overflow menu -->
<style name="MyPopupMenu" parent="android:style/Widget.Holo.Light.ListPopupWindow">
<item name="android:popupBackground">#303030</item>
</style>
+4
source to share