Search code examples
androidactionbarsherlock

ActionbarSherlock and homeAsUpIndicator


I have the problem to customize the back arrow. I want a red arrow instead of default arrow. I've read many topics about that but it doesn't work.

So i place my styles in res/values/styles.xml. Here is my code :

<style name="AppBaseTheme" parent="Theme.Sherlock.Light">

    <item name="actionBarStyle">@style/Widget.AppTheme.ActionBar</item>
    <item name="homeAsUpIndicator">@drawable/btn_nav_retour</item>

</style>

I can't set "android:homeAsUpIndicator" beacause it requires api level 11 and my min sdk is 9.

Should I set the same code in res/values-v11/styles.xml ?

Thx


Solution

  • To work in all API's you should create style.xml in values-v11 and values-v14 folder. In values-v14 for example you should use:

    <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
        <item name="android:actionBarStyle">@style/Widget.AppTheme.ActionBar</item>
        <item name="android:homeAsUpIndicator">@drawable/btn_nav_retour</item>
    </style>
    

    In default values folder you should use attributes given by ActionBarSherlock, but for higher API levels you should stick with Android default ActionBar attributes and place android: in front of them. In that way it will work for higher API levels.