最近我一直在问加有不同的颜色或背景比其他菜单项特殊的溢出菜单项 - 只是一个项目
Recently I've been asked to add a special overflow menu item which has a different color or background than other menu items -- just that one item.
我已经有一个自定义的主题我的溢出菜单的外观,所以我不需要对如何使用主题的风格我所有菜单项的信息。我只需要改变一个的外观。
I already have a custom theme for the appearance of my overflow menu, so I do not need information on how to use a theme to style all my menu items. I just need to change the appearance of one.
这是可能的,如何?
积分为解决工作ActionBarSherlock,不过说真的,我会采取什么。
Bonus points for solutions working on ActionBarSherlock, but really, I'll take anything.
我还没有试过,但菜单资源文件说,一个菜单<项目>
可以有一个安卓actionLayout
属性。
I haven't tried this, but the Menu Resource documentation says that a menu <item>
can have an android:actionLayout
attribute.
所以,你应该能够指定一个自定义布局的一个菜单项,并使用一个样式,一个布局是从整体的主题不同。
So, you should be able to specify a custom layout for your one menu item, and use a style for that one layout that's different from the overall theme.