Boli-CS
Boli-CS

Reputation: 560

How to change colors of actionbarsherlock tabs color and the line under the tabs?

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.

Upvotes: 2

Views: 2769

Answers (3)

i'm Ahmad
i'm Ahmad

Reputation: 67

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.

Upvotes: 1

Shadow
Shadow

Reputation: 6899

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.

Upvotes: 0

mmBs
mmBs

Reputation: 8559

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.

Upvotes: 7

Related Questions