0

I want to change the Color of my action Bar instead of white text I want #59380d so I added the color to a color.xml like this:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:color="#59380d"/>
</selector>

And Then I call it into my styles.xml like this:

<resources>
    <style name="AppBaseTheme" parent="android:Theme.Light">
        <item name="android:textColor">@color/header</item>
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <item name="android:textColor">@color/header</item>
    </style>
</resources>

And finally at my AndroidManifest I set it the aplication like this:

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:name="com.app.activities.MyAp"
    android:theme="@style/AppTheme" >

 ...
</aplication>

But the text of the Action Bar still White. What I'm doing wrong

jordiPons
  • 164
  • 5
  • 21
  • 1
    you can check [this](http://stackoverflow.com/questions/28888852/android-toolbar-text-color) if you are using toolbar,both answers are excellent,or google more if not – Elltz May 14 '15 at 18:52
  • Have a look at [this](http://stackoverflow.com/questions/8607707/how-to-set-a-custom-font-in-the-actionbar-title), it explains how you can set a custom font and color on the actionbar text. It is not as simple you would think.. – JPS May 14 '15 at 18:53
  • Ok i solved the problem, thank you @Elltz the link help me a lot. I added the @color/header into the styles.xml and it works – jordiPons May 14 '15 at 19:03

2 Answers2

1

For Android 3.0 and higher you need to override:

<style name="CustomActionBarTheme" parent="@style/Theme.Holo">
    <item name="android:actionBarStyle">@style/MyActionBar</item>
</style>

<!-- ActionBar styles -->
<style name="MyActionBar" parent="@style/Widget.Holo.ActionBar">
    <item name="android:titleTextStyle">@style/MyActionBarTitleText</item>
</style>

<!-- ActionBar title text -->
<style name="MyActionBarTitleText" parent="@style/TextAppearance.Holo.Widget.ActionBar.Title">
    <item name="android:textColor">@color/actionbar_text</item>
</style>

For 2.1 and higher:

<style name="CustomActionBarTheme" parent="@style/Theme.AppCompat">
    <item name="android:actionBarStyle">@style/MyActionBar</item>

    <!-- Support library compatibility -->
    <item name="actionBarStyle">@style/MyActionBar</item>
</style>

<!-- ActionBar styles -->
<style name="MyActionBar" parent="@style/Widget.AppCompat.ActionBar">
    <item name="android:titleTextStyle">@style/MyActionBarTitleText</item>

    <!-- Support library compatibility -->
    <item name="titleTextStyle">@style/MyActionBarTitleText</item>
</style>

<!-- ActionBar title text -->
<style name="MyActionBarTitleText" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
    <item name="android:textColor">@color/actionbar_text</item>
    <!-- The textColor property is backward compatible with the Support Library -->
</style>
Marcin S.
  • 11,161
  • 6
  • 50
  • 63
0

To cHange The Text COlor

ActionBar actionBar = getActionBar();
         actionBar.setTitle(Html
         .fromHtml("<font color='#59380d'> Your Text </font>"));
Quick learner
  • 10,632
  • 4
  • 45
  • 55