2 Ways to Change Home As Up Indicator/Navigation Icon in Android Studio

Home as up indicator or back arrow button generally takes the user to previous activity from the current activity in the app. An arrow directing to the left is the default home as up indicator icon in the android project. To make the UI more attractive we can change home as up indicator in the android project from a default icon to custom icon.

To do so, we need an icon that suits different screen sizes of Android smartphones. You can create icons for different screen size easily from here . After creating the icon pack and downloading the icon pack, extract it and do the following.

Select the all folders from the extracted folder and paste them res folder in your android project. Now the res folder will look like below.

home as up indicator icon

#1. By using the styles:

  • Go to values folder and open styles.xml file and add the following line under app theme.

When we use homeAsUpIndicator, we must call setDisplayHomeAsUpEnabled(true).

  • if we don’t want to call setDisplayHomeAsUpEnabled(true), we can define item as follow

#2. Programmatically:

  • Define a tool bar in layout file, give id as “toolbar” and add the following.

  • You can also add the icon using toolbar reference.

Now home as up indicator will look like as below

change home as up indicator icon


We can set any icon that we like as home as up indicator but make sure that the icon supports different screen sizes otherwise the icon may blur on high-resolution devices.

You May Also Like

About the Author: Sama Gyani

I am Computer Science Graduate. I turn my interests into posts here.

Leave a Reply

Your email address will not be published. Required fields are marked *