Android Home As Up File or Location Indicator

Where can I find the Android Up button so that it can be customized? Or what is its file name, so that I can do a quick search to find it in the sdk directory?

+6
source share
1 answer

As you can see in the default style (at the end), the 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 (the "Up" and "Application" icons) is hard-coded into layout resources; it can be difficult to change or customize. However, you didn’t explain much, so I’ll try to answer the possible settings.

You can customize the Up indicator in your style and place 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 the ActionBar style.

Then, if you want to change the size of the indentation between Up and the icon, you have the following solutions:

  • Create a custom view and hide the built-in home navigation ( see example ).
  • Change it with setPadding dynamically (however, this should be used for every action, and it's a bit messy).
  • Use drawable layer-list and replace the homeAsUpIndicator theme ( described here ).

Finally, you can get this icon on the Android Drawable website , as well as in / res / drawable-xxx with the name 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 with the name "arrow-left".

Hope this will be helpful.

+7
source

All Articles