Impossible to customize the theme / style

585 views
Skip to first unread message

Yannick Lemin

unread,
May 18, 2012, 4:23:33 AM5/18/12
to actionba...@googlegroups.com
Hello all,

I am using ActionBarSherlock version 4.0.2.
I have tried everything I could but nothing works, I do not succeed to change the theme.
My goal is to user Theme.Sherlock.Light but replace the blue color of the tabs to an orange color. I followed all the instructions to the letter on the site, on the official android documentation, I even tried this tool http://jgilfelt.github.com/android-actionbarstylegenerator but nothing works.

Here is a sample of my code:

  <style name="Theme.Greenthumb" parent="Theme.Sherlock.Light">
    <item name="actionBarTabStyle">@style/Widget.Greenthumb.ActionBar.TabView</item>
    <item name="android:actionBarTabStyle">@style/Widget.Greenthumb.ActionBar.TabView</item>
  </style>

  <style name="Widget.Greenthumb.ActionBar.TabView" parent="Widget.Sherlock.ActionBar.TabView">
    <item name="android:background">@drawable/tab_indicator</item>
  </style>

    <!-- Non focused states -->
    <item android:state_focused="false" android:state_selected="false" android:state_pressed="false" android:drawable="@android:color/transparent" />
    <item android:state_focused="false" android:state_selected="true"  android:state_pressed="false" android:drawable="@drawable/tab_selected" />

    <!-- Focused states -->
    <item android:state_focused="true" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/abs__list_focused_holo" />
    <item android:state_focused="true" android:state_selected="true"  android:state_pressed="false" android:drawable="@drawable/tab_selected_focused" />

    <!-- Pressed -->
    <!--    Non focused states -->
    <item android:state_focused="false" android:state_selected="false" android:state_pressed="true" android:drawable="@drawable/abs__list_pressed_holo_dark" />
    <item android:state_focused="false" android:state_selected="true"  android:state_pressed="true" android:drawable="@drawable/tab_selected_pressed" />

    <!--    Focused states -->
    <item android:state_focused="true" android:state_selected="false" android:state_pressed="true" android:drawable="@drawable/tab_unselected_pressed" />
    <item android:state_focused="true" android:state_selected="true"  android:state_pressed="true" android:drawable="@drawable/tab_selected_pressed" />
</selector>


In the manifest I have set the theme at the application level.
I am really confused as to what is the problem.

Could anyone give me a clue please?
I thank you very much in advance :)

Yann

chuckliddell0

unread,
May 18, 2012, 11:53:00 AM5/18/12
to ActionBarSherlock
Hi there,

In your code you have...

<style name="Widget.Greenthumb.ActionBar.TabView"
parent="Widget.Sherlock.ActionBar.TabView">
<item name="android:background">@drawable/tab_indicator</item>
</style>

Here you need to add in...

<item name="background">@drawable/tab_indicator</item>

Your end result will look like...


<style name="Widget.Greenthumb.ActionBar.TabView"
parent="Widget.Sherlock.ActionBar.TabView">
<item name="background">@drawable/tab_indicator</item>
<item name="android:background">@drawable/tab_indicator</item>
</style>

You can find more information here... http://actionbarsherlock.com/theming.html

Hope this helps,

Chuck


On May 18, 9:23 am, Yannick Lemin <yanng...@gmail.com> wrote:
> Hello all,
>
> I am using ActionBarSherlock version 4.0.2.
> I have tried everything I could but nothing works, I do not succeed to
> change the theme.
> My goal is to user Theme.Sherlock.Light but replace the blue color of the
> tabs to an orange color. I followed all the instructions to the letter on
> the site, on the official android documentation, I even tried this toolhttp://jgilfelt.github.com/android-actionbarstylegeneratorbut nothing

Jake Wharton

unread,
May 18, 2012, 12:03:27 PM5/18/12
to actionba...@googlegroups.com
You actually shouldn't need the duplication there. Only the theme, action bar style, and action mode style should need duplicated attributes. Everything looks correct from my quick look through but I haven't had a chance to try it yet.

Did you look at the 'styled' sample? It customizes the drawables that are used for tabs. You might find something helpful in there before I'm able to test out your styles.

---
Jake Wharton
http://about.me/jakewharton

Yannick Lemin

unread,
May 19, 2012, 7:08:13 AM5/19/12
to actionba...@googlegroups.com
Thank you both Chuck and Jake,

I did try to add the background item but it didn't change anything.
I did look at the styled sample, and everything I do seems very similar ... 

Plus the files generated by the tool I tried do not change anything either.

Is there anything special to do in the project to get it to react ?

Yann

rafaant...@gmail.com

unread,
May 16, 2013, 7:30:01 PM5/16/13
to actionba...@googlegroups.com
I'm having the same problem, and it's making me go sick!!

I do everything that tuts and official web says but...it makes no difference, I don't get any change of that blue thin stripes under the selected tab. I just want them red, kinda. I also tried the code from the styled sample project and nothing happened again. Please if anyone finds something tell us. Thanks
Reply all
Reply to author
Forward
0 new messages