按照这里给出的答案,我尝试将自定义背景应用到我的溢出菜单,但我没有运气。我知道我的" AppTheme"正在应用,因为正在应用actionBarStyle
。
问题是" MyPopupMenu"没有被应用。
这是我的values-v11文件夹中的styles.xml:
<color name="custom_theme_action_bar_color">#0288d1</color>
<color name="custom_theme_action_bar_text_color">#ffffff</color>
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
</style>
<style name="AppTheme" parent="AppBaseTheme">
<!-- API 11 theme customizations can go here. -->
<item name="android:actionBarStyle">@style/MyActionBarTheme</item>
<item name="android:popupMenuStyle">@style/MyPopupMenu</item>
</style>
<style name="MyActionBarTheme" parent="@android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">@color/custom_theme_action_bar_color</item>
<item name="android:titleTextStyle">@style/MyTheme.ActionBar.TitleTextStyle</item>
</style>
<style name="MyPopupMenu" parent="@android:style/Widget.Holo.Light.ListPopupWindow">
<item name="android:popupBackground">@drawable/menu_dropdown_panel_example</item>
</style>
<style name="MyTheme.ActionBar.TitleTextStyle" parent="@android:style/TextAppearance">
<item name="android:textColor">@color/custom_theme_action_bar_text_color</item>
</style>