Search code examples
androidandroid-layoutandroid-actionbarandroid-actionbar-compat

Home Icon Up Indicator Compat Action Bar


I'm trying to change the "up" indicator, I've implemented the new compat action bar and I'm not able to customize it.

I've tried adding to values-v11/styles.xml

<style name="MyActionBar" parent="@style/Widget.AppCompat.Light.ActionBar">
    <item name="android:icon">@drawable/ic_action_logo_barra_de_acciones_blanco</item>
    <item name="android:background">@drawable/action_bar_style</item>
    <item name="android:homeAsUpIndicator">@drawable/arrow_up_black</item>
</style>

and to values/styles.xml

<style name="MyActionBar" parent="@style/Widget.AppCompat.Light.ActionBar">
    <item name="background">@drawable/action_bar_style</item>
    <item name="icon">@drawable/ic_action_logo_barra_de_acciones_blanco</item>
    <item name="homeAsUpIndicator">@drawable/arrow_up_black</item>
</style>

But is still not working.

Thanks in advance, Diego.


Solution

  • Sorry, maybe already late, but I had same issue and solved it by defining "homeAsUpIndicator" in main theme before ActionBar style. Here is my res/values/styles.xml

    <style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light">
    </style>
    
    <style name="AppTheme"  parent="AppBaseTheme">
        <item name="homeAsUpIndicator">@drawable/abc_ic_ab_back_holo_dark</item>
        <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
    </style>
    
    <style name="Widget.Styled.ActionBar" parent="@style/Widget.AppCompat.Light.ActionBar">
        <item name="background">@drawable/messages_form_banner</item>
    </style>
    

    I hope it will help you.