我在白色背景上看到白色文字 - 如何将ActionBar
弹出窗口中的文字颜色从白色更改为黑色?
这是我的主题:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/material_bg</item>
<item name="colorPrimaryDark">@color/status_bar</item>
<item name="colorAccent">@color/edittext_primary</item>
<item name="android:windowBackground">@color/light_blue</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:textColorPrimaryInverse">@android:color/white</item>
<item name="android:textColorPrimary">@android:color/white</item>
<item name="actionMenuTextColor">@android:color/white</item>
<item name="android:textColorSecondary">@android:color/white</item>
<item name="drawerArrowStyle">@style/WhiteDrawerIconStyle</item>
<item name="textAppearanceLargePopupMenu">@style/myPopupMenuTextAppearanceLarge</item>
<item name="android:textAppearanceLargePopupMenu">@style/myPopupMenuTextAppearanceLarge</item>
<item name="textAppearanceSmallPopupMenu">@style/myPopupMenuTextAppearanceSmall</item>
<item name="android:textAppearanceSmallPopupMenu">@style/myPopupMenuTextAppearanceSmall</item>
<item name="popupMenuStyle">@style/myPopupMenuStyle</item>
<item name="android:popupMenuStyle">@style/myPopupMenuStyle</item>
</style>
<style name="myPopupMenuStyle" parent="@style/Widget.AppCompat.PopupMenu"></style>
<style name="myPopupMenuTextAppearanceSmall" parent="@style/TextAppearance.AppCompat.Light.Widget.PopupMenu.Small">
<item name="android:textColor">#000000</item>
</style>
<style name="myPopupMenuTextAppearanceLarge" parent="@style/TextAppearance.AppCompat.Light.Widget.PopupMenu.Large">
<item name="android:textColor">#000000</item>
</style>
答案 0 :(得分:1)
将此样式放入res,
<style name="MyAppActionBarTheme" parent="android:Theme.Holo.Light">
<item name="android:popupMenuStyle">@style/MyApp.PopupMenu</item>
<item name="android:actionBarStyle">@style/MyApp.ActionBar</item>
</style>
<!-- The beef: background color for Action Bar overflow menu -->
<style name="MyApp.PopupMenu" parent="android:Widget.Holo.Light.ListPopupWindow">
<item name="android:popupBackground">@drawable/menu_dropdown_panel</item>
</style>
<!-- Bonus: if you want to style whole Action Bar, not just the menu -->
<style name="MyApp.ActionBar" parent="android:Widget.Holo.Light.ActionBar.Solid">
<!-- Blue background color & black bottom border -->
<item name="android:background">@drawable/blue_action_bar_background</item>
</style>
当然,在AndroidManifest.xml中:
<application
android:theme="@style/MyAppActionBarTheme"
... >
您使用此设置获得了什么:
答案 1 :(得分:0)
尝试此主题,如果您使用的是android.support.v7.widget.Toolbar,
它将解决您的问题。
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"