2

My question is simple to understand. How to change colors of ActionBarSherlock Tabs Color and the line under the tabs?

In the AndroidManifest, in the application part, I write:

android:theme="@style/Theme.Sherlock"

I want to change the colors of the tabs and the lines under the tabs.

I tried a lot of ways that I could find in the stackOverflow but they do not work.

jimpanzer
  • 3,470
  • 4
  • 44
  • 84
Boli-CS
  • 550
  • 1
  • 5
  • 14

3 Answers3

7

You can use this to generate custom styles for your ActionBar. There you have an accent color (line under tabs) and stacked color (it describes tabs color). Generate 9 patch files, copy to your res folder and copy suitable styles to your styles.xml.

mmBs
  • 8,421
  • 6
  • 38
  • 46
1

you can change color of tab by changing drawbles of Sherlock liberary. in drawable folder of Sherlock there is some png files. for changing color of line under tab you should edit "abs__tab_selected_pressed_holo.9.png" and "abs__tab_selected_holo.9.png".

for changing tab color you should change "abs__ab_stacked_solid_light_holo.9.png".

and another files similar to this. note that you should change drawable-mdpi and drawable-xhdpi and other platform folders too.

Josh Crozier
  • 233,099
  • 56
  • 391
  • 304
i'm Ahmad
  • 67
  • 13
0

In styles.xml use like this whatever color you need.

<style name="Theme.A" parent="Theme.Sherlock.Light">
  <item name="actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
  <item name="android:titleTextStyle">@style/Widget.MyTheme.ActionBar.TitleTextStyle</item>
</style>

<style name="Widget.MyTheme.ActionBar" parent="Widget.Sherlock.ActionBar">
  <item name="android:background">@color/green</item>
  <item name="background">@color/green</item>
</style>

<style name="Widget.MyTheme.ActionBar.TitleTextStyle" parent="TextAppearance.Sherlock.Widget.ActionBar.Title">
  <item name="android:textColor">@android:color/white</item>
</style> 

Such a way you can use it.

Rodja
  • 7,998
  • 8
  • 48
  • 55
Shadow
  • 6,864
  • 6
  • 44
  • 93
  • Actually, it works. The tabs' background is white now but the lines under the tabs are still blue and this theme change the color of my title into black which is white before. – Boli-CS Apr 24 '13 at 10:21
  • Could you please tell me how to change color of the lines at the bottom of the tabs? – Boli-CS Apr 28 '13 at 14:49
  • @shadow, it's need to put it actionbarsherlock project styles.xml or in that project, wich uses actionbarsherlock as library(or like added source) ? – redL1ne Dec 09 '15 at 11:54