Luminusss
Luminusss

Reputation: 571

Customize color of text on Actionbar

I am just starting to learn android development and have been going through the tutorials from android. But I'm stuck at a part trying to change the text color and style of the action bar. I am not sure at all why this isn't working. Is there something else I need to do with this or is something not right? I want to make the text white, but it shows as black. Please let me know! Thanks!

<resources>   
<style name="CustomActionBarTheme" parent="android:Theme.Holo.Light.DarkActionBar">
    <item name="android:actionBarStyle">@style/myActionBar</item>
</style>


<style name="myActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
    <item name="android:background">#088A29</item>
    <item name="android:textColor">#000000</item>    
    <item name="android:typeface">monospace</item>
</style>
</resources>

Edit: The background color works as well, so it just confuses me even more why the text won't adjust.

Upvotes: 0

Views: 245

Answers (1)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 364868

You can use something like this:

<resources>

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

    <style name="MyTheme.ActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
        <item name="android:background">@drawable/actionbarbground</item>
        <item name="android:titleTextStyle">@style/MyTheme.ActionBar.Text</item>
    </style>

    <style name="MyTheme.ActionBar.Text" parent="@android:style/TextAppearance">
        <item name="android:textColor">@color/actionBarText</item>
    </style>

</resources>

Also the best way to change the style is to use this tool: http://jgilfelt.github.com/android-actionbarstylegenerator/

Upvotes: 2

Related Questions