更改Android的动作条字幕颜色 [英] Change Android Actionbar subtitle colour

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

问题描述

我希望我的Andr​​oid应用程序的自定义动作条。
我使用的ActionBar福尔摩斯。
我的分目标SDK是14,目标SDK 17
我有一个改变背景颜色和主标题文字的主题
但我不能改变的字幕文本颜色
我的风格是这里显示

I wish to customize the actionBar of my android application.
I am using Actionbar Sherlock.
My min target sdk is 14, target sdk 17.
I have a theme that changes the background colour and main title text
however i cannot change the subtitle text colour
my style is shown here

<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>
    <item name="android:background">#8B0000</item>
</style>

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

</style>

<style name="MyTheme.ActionBar.Subtitle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Subtitle">
    <item name="android:textColor">#FF0000</item>

</style>


你有什么一个做错了?


what have a done wrong?

推荐答案

只要修改 titleTextStyle subtitleTextStyle

<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:subtitleTextStyle">@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>

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

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