对一个项目的溢出菜单更改颜色/外观 [英] Change color/appearance of ONE item in the overflow menu

查看:260
本文介绍了对一个项目的溢出菜单更改颜色/外观的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我一直在问加有不同的颜色或背景比其他菜单项特殊的溢出菜单项 - 只是一个项目

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.

这篇关于对一个项目的溢出菜单更改颜色/外观的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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