棒棒糖:DarkActionBar上不需要的灯光菜单
作者:互联网
我有一个带有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>
这是错误吗?如何改变?
解决方法:
最后:
<!--
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>
标签:android-styles,android 来源: https://codeday.me/bug/20191029/1956835.html