操作栏文字颜色 [英] ActionBar text color

查看:25
本文介绍了操作栏文字颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改 ActionBar 的文本颜色?我继承了 Holo Light 主题,可以更改 ActionBar 的背景,但我不知道要调整以更改文本颜色的属性是什么.

how can I change the text color of the ActionBar? I've inherited the Holo Light Theme, I'm able to change the background of the ActionBar but I don't find out what is the attribute to tweak to change the text color.

好的,我可以使用属性 android:textColorPrimary 更改文本颜色,但它还会更改在 ActionBar 按钮上发生溢出时显示的下拉菜单的文本颜色.知道如何更改那些下拉菜单/列表的颜色吗?

Ok, I'm able to change the text color with the attribute android:textColorPrimary but it also changes the text color of the dropdown menu displayed when an overflow happen on the ActionBar buttons. Any idea how to change the color of those dropdown menu / List ?

推荐答案

好的,我找到了更好的方法.我现在只能更改标题的颜色.您还可以调整副标题.

Ok, I've found a better way. I'm now able to only change the color of the title. You can also tweak the subtitle.

这是我的styles.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <style name="MyTheme" parent="@android:style/Theme.Holo.Light">
    <item name="android:actionBarStyle">@style/MyTheme.ActionBarStyle</item>
  </style>

  <style name="MyTheme.ActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar">
    <item name="android:titleTextStyle">@style/MyTheme.ActionBar.TitleTextStyle</item>
  </style>

  <style name="MyTheme.ActionBar.TitleTextStyle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
    <item name="android:textColor">@color/red</item>
  </style>
</resources>

这篇关于操作栏文字颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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