更改动作条标题字体颜色 [英] Changing ActionBar Title Text Color

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

问题描述

我试图改变在动作条的标题文本的颜色,但我似乎无法得到它的工作

I am trying to change the color of the Title Text in the ActionBar but I cannot seem to get it to work

这是我的风格,我试图用

this is my style I am trying to use

<style name="TitleColorStyle" parent="android:TextAppearance.Holo.Widget.ActionBar.Title">
    <item name="android:textColor">@android:color/white</item>
</style>

和我的应用程序的主题我用的是 titleTextStyle

and in my app theme I use the titleTextStyle

<style name="AppTheme" parent="android:Theme.Holo.Light">

    <item name="android:windowContentOverlay">@null</item>
    <item name="android:actionOverflowButtonStyle">@style/MyActionButtonOverflow</item>
    <item name="android:actionDropDownStyle">@android:style/Widget.Holo.Spinner</item>
    <item name="android:titleTextStyle">@style/TitleColorStyle</item>
</style>

我是没有使用正确的样式来改变颜色?

am I not using the correct style to change the color?

推荐答案

您需要设置一个自定义的样式 actionBarStyle 再修改 titleTextStyle 像这样

You need to set a custom style for actionBarStyle and then change the titleTextStyle like this

 <style name="ThemeHoloLight" parent="android:Theme.Holo.Light">
    <item name="android:actionBarStyle">@style/ActionBarStyle</item>
</style>

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

<style name="HoloTitleText" parent="android:TextAppearance.Holo">
    <item name="android:textColor">@android:color/white</item>
</style>

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

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