Android的菜单项的背景 [英] Android menu item background
问题描述
我要更改的菜单项的背景怎么一回事,因为我用黑色的图标,但在某些手机上的背景默认颜色为黑色或其他深色。我尝试<一href="http://www.android10.org/index.php/forums/43-view-layout-a-resource/195-customizing-the-options-menu-background"相对=nofollow> ,它的工作,但有一点一点改进它这个解决方案: 我有十个项目,这就是为什么我有一个更多选项,以显示其他的选择,但如果我选择更多的项目(即得自定义背景),之后我preSS后退按钮,该项目将在默认状态下,默认颜色。解决办法是什么?谢谢!
I want to change the menu item background beacuse I use black icons, but on some phones the default color of background is black or other dark color. I tried this solution and it's worked but there was a little problen with it: I have ten items and that's why I have a "More" item to show other options, but if I choose the More item (which is got the custom background) and after that I press back button, the item will be in the default state, default colors. What is the solution? Thanks!
推荐答案
的样式属性菜单背景安卓panelFullBackground
。这不是hackish的像其他的解决方案,所以它不是越野车。
The style attribute for the menu background is android:panelFullBackground
. It's not hackish like the other solution, so it's not as buggy.
尽管什么文件说,它需要的资源(例如: @android:彩色/黑白
或 @绘制/ my_drawable
),它会崩溃,如果你直接使用的颜色值。
Despite what the documentation says, it needs to be a resource (e.g. @android:color/black
or @drawable/my_drawable
), it will crash if you use a color value directly.
这篇关于Android的菜单项的背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!