简体   繁体   English

如何使用ActionBarCompat更改文本菜单项的颜色?

[英]How do I change the color of a text menu item with ActionBarCompat?

I have the title color set correctly, but I'm not sure what I need to style to change the menu "icon" text color in the ActionBarCompat. 我已经正确设置了标题颜色,但是不确定在ActionBarCompat中更改菜单“ icon”文本颜色所需的样式。 I want the "Login/Join" text to be white. 我希望“登录/加入”文本为白色。

Sorry, I'm sure the solution is out there on StackOverflow, but I haven't been able to string together the right keywords to find it :) 抱歉,我确定该解决方案在StackOverflow上可用,但是我无法将正确的关键字串在一起来找到它:)

在此处输入图片说明

I couldn't figure out how to change that value programmatically or via xml aside from altering the base parent theme. 除了更改基本父主题外,我无法弄清楚如何以编程方式或通过xml更改该值。 I ended up changing my theme to inherit from Theme.AppCompat and set the titleTextStyle ( https://stackoverflow.com/a/5881739/413254 ). 我最终将主题更改为从Theme.AppCompat继承,并设置titleTextStyle( https://stackoverflow.com/a/5881739/413254 )。 I was inheriting from Theme.AppCompat.Light which naturally makes all text in the actionbar dark. 我继承自Theme.AppCompat.Light ,它自然会使操作Theme.AppCompat.Light所有文本变暗。 Another option was to inherit from Theme.AppCompat.Light.DarkActionBar (which would have saved me a lot from multiple xml style headaches). 另一个选择是从Theme.AppCompat.Light.DarkActionBar继承(这将使我从多个xml样式麻烦中省去很多)。

One of those situations where you get caught up in the details and miss the more fundamental things :P. 在其中一种情况中,您陷入细节,却错过了更基本的东西:P。 Hope this helps somebody. 希望这对某人有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM