如何设置安卓的PopupMenu的白背景 [英] How to set the background of Android PopupMenu to White

查看:187
本文介绍了如何设置安卓的PopupMenu的白背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我挣扎与设置PopupMenu的背景。 Google上搜寻了一​​段时间之后,我发现它应该进入到应用程序的主题。更具体而言,这应该在style.xml定义

I'm struggling with setting the background of PopupMenu. After googling it for a while, I found it should goes to the app theme. To be more specific, this should be defined in the style.xml.

<style name="AppTheme" parent="AppBaseTheme">
    <item name="android:popupMenuStyle">MY_STYLE</item>
</style>

不过,我并没有真正搞清楚哪种风格正是我应该使用,因为我想有一个内置的之一。我试着用 @android:款式/ Widget.Holo.PopupMenu @android:款式/ Widget.Holo.Light.PopupMenu ,但没有运气。

推荐答案

例如,尝试是这样的:

<style name="Theme.MyAppTheme" parent="@style/Theme.Holo.Light">
    <item name="popupMenuStyle">@style/PopupMenu.MyAppTheme</item>
</style>

,然后在自己的风格:

And then on the style itself:

<style name="PopupMenu.MyAppTheme" parent="@style/Widget.Holo.Light.ListPopupWindow">
    <item name="android:popupBackground">@drawable/popup_menu_bg_color</item>
</style>

这是它通过 ActionBarStyleGenerator 以及一些旧的在这里引用的<一个完成的方式HREF =htt​​p://android-developers.blogspot.com/2011/04/customizing-action-bar.html相对=nofollow>开发者网站。

That is the way it's done via ActionBarStyleGenerator and some old references here on the Developer Site.

这篇关于如何设置安卓的PopupMenu的白背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆