如何以编程方式更改ActionBar菜单项的文本颜色? [英] How do I programmatically change ActionBar menuitem text colour?

查看:86
本文介绍了如何以编程方式更改ActionBar菜单项的文本颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含多个项目的actionBar,我想在单击该项目时更改文本的颜色.无论如何,有计划地这样做吗?请提供示例和任何资源.

I have an actionBar with multiple items, I would like to change the colour of the text when the item is clicked. Is there anyway to do this programmatically? Please provide and example or any resources.

谢谢

  public void catalogClick(MenuItem item){
     //highlight menuitem etc.

  }

推荐答案

点击此链接,其中说明了如何以编程方式更改菜单项文本.

Follow this link which explains how to change menuitem text programmatically.

http://developer.android.com/guide/topics/ui/actionbar.html#Style

检查android:actionMenuTextColor是否为文本定义样式资源.

Check for android:actionMenuTextColor for defining a style resource for text.

这篇关于如何以编程方式更改ActionBar菜单项的文本颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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