Question

Where do I find the Android "Up" button drawable so that I can customize it? Or what is its filename, so that I can do a quick search to locate it within a sdk directory?

Was it helpful?

Solution

As you can see in default style (at the end), ActionBar style uses this:

<style name="Widget.Holo.Light.ActionBar" parent="Widget.Holo.ActionBar">
    <item name="android:homeAsUpIndicator">@android:drawable/ic_ab_back_holo_light</item>
</style>

You can find the layout resource used to display the Up and App icon on your ActionBar. The positioning of these elements (Up and App icon) are hard-coded into the layout resources, it might be difficult to change or customize it.. However, you didn't explain a lot, so I'll try to answer on possible customizations.

You can customize the Up indicator in your style and put your own icon as follows:

<style name="Theme" parent="@style/Theme.Holo.Light">
    <item name="android:homeAsUpIndicator">@drawable/ic_up_indicator</item>
</style>  

Note: it must be in the parent style, not in ActionBar's style.

Then, if you want to resize the padding between Up and icon, you have these solutions:

  1. Create a custom view and hide the built home navigation (see an example).
  2. Change it with setPadding dynamically (however, this have to be used on each activity, and it's a bit messy).
  3. Use a drawable layer-list and replace the homeAsUpIndicator theme (described here).

Finally, you can get this icon on Android Drawable's website and also in /res/drawable-xxx named ic_ab_back_holo_light_am.png and ic_ab_back_holo_dark_am.png.

UPDATE:
And since MaterialDesign, you can find this icon on Material Design Icons named "arrow-left".

I hope this will be useful.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top