4

I want to change my ActionBar color to blue (#0c01e3). My code is working because the actionbar background property is doing its job. But the text won't change. Any ideas? I'm using ABS.

<style name="MyActionBar1" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
        <item name="android:backgroundSplit">#06e301</item>
        <item name="android:backgroundStacked">#06e301</item>
        <item name="android:background">#06e301</item>
        <item name="background">#06e301</item>
        <item name="backgroundSplit">#B9001F</item>
        <item name="android:textColor">#0c01e3</item>
        >

enter image description here

Update

:

enter image description here

EGHDK
  • 17,818
  • 45
  • 129
  • 204
  • Which text are you trying to change? Are you trying to change the text of the ActionItems,Tabs, or spinner text? – Marco RS Sep 21 '12 at 05:17
  • 1
    http://stackoverflow.com/questions/10352022/how-to-set-title-color-in-actionbarsherlock Check out this post. – Marco RS Sep 21 '12 at 05:22
  • It looks like I need to not include the proceeding "android:" but I get an error. I'm updating my question with a picture now. – EGHDK Sep 21 '12 at 05:35
  • possible duplicate of [ActionBar text color](http://stackoverflow.com/questions/5861661/actionbar-text-color) – Sam Sep 22 '12 at 18:43

5 Answers5

2

Set this in your Java Page .It works for me

ActionBar ab = getActionBar();    
 ab.setTitle(Html.fromHtml("<font color='#ffffff'>App Name</font>"));
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
1

add this and then try

    <item name="android:textColor">#ffffff</item>
raghav chopra
  • 827
  • 3
  • 9
  • 25
1

On the theme, there is an attribute, actionItemTextColor, which controls this color.

Remember to specify it with and without the android: prefix when using ActionBarSherlock.

Jake Wharton
  • 75,598
  • 23
  • 223
  • 230
0

To improve on the answer of @IntelliJ Amiya:

    getActionBar().setTitle(
            Html.fromHtml("<font color='" + getResources().getColor(R.color.my_color) + "'>"
                    + getString(R.string.title_home) + "</font>"));
brandall
  • 6,094
  • 4
  • 49
  • 103
0

If you want to change that using xml ... This is what worked for me ...

<style name="MyActionBar"
    parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
    <item name="android:background">@color/titleBarBgColor</item>
    <item name="android:titleTextStyle">@style/EldTheme.ActionBar.TitleTextStyle</item>
    <item name="android:subtitleTextStyle">@style/EldTheme.ActionBar.TitleTextStyle</item>
    <!-- Support library compatibility -->
    <item name="background">@color/titleBarBgColor</item>
    <item name="titleTextStyle">@style/EldTheme.ActionBar.TitleTextStyle</item>
    <item name="subtitleTextStyle">@style/EldTheme.ActionBar.TitleTextStyle</item>
</style>
<style name="EldTheme.ActionBar.TitleTextStyle" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
    <item name="android:textColor">@color/titleBarTextColor</item>
</style>
Ninad Desai
  • 558
  • 1
  • 7
  • 10