简体   繁体   English

没有Sherlock的情况下如何更改操作栏文本的颜色?

[英]How do you change the action bar text color without Sherlock?

I don't want to use the Sherlock action bar, but I do want to change the text color. 我不想使用Sherlock操作栏,但是我想更改文本颜色。 I know how to change the actual text 我知道如何更改实际文字

ActionBar actionBar = getActionBar();
actionBar.setTitle("Whatever");

but I don't know how to change the color. 但我不知道如何改变颜色。 I have also tried this: 我也尝试过这个:

    <style name="ActionBar.Solid.Example" parent="@android:style/Widget.Holo.Light.ActionBar.Solid">
    <item name="android:background">@drawable/ab_background_textured_example</item>
    <item name="android:backgroundStacked">@drawable/ab_stacked_solid_example</item>
    <item name="android:backgroundSplit">@drawable/ab_background_textured_example</item>
    <item name="android:progressBarStyle">@style/ProgressBar.Example</item>
    <item name="android:textColor">@android:color/white</item>
   </style>

From the "Android Holo Colors Generator", I added the line 在“ Android Holo颜色生成器”中,添加了以下行

        <item name="android:textColor">@android:color/white</item>

but it didn't do anything. 但是它什么也没做。

Any help? 有什么帮助吗? Thanks! 谢谢!

Seems you must use 似乎必须使用

<item name="android:actionBarStyle">@style/Widget.MyApp.ActionBar</item>

Here is solved the similiar problem: Action Bar Sherlock 4 title text colour - where am I going wrong? 这里解决了类似的问题: Action Bar Sherlock 4标题文本颜色-我在哪里出错?

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

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