我有一个非常基本的应用程序与DarkActionBar。
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
</style>
现在我在Android Lollipop上测试它。操作栏很暗,但弹出菜单很亮。在以前的Android版本中情况并非如此。
我尝试了这个,但效果并不理想(深色背景上的深色文字):
<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>
这是一个错误吗?如何改变?
答案 0 :(得分:4)
最后:
<!--
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>