

Run the app, and you will be able to see the toolbar with app name and the back arrow icon.They’re a new icon format with different shape varieties. Adaptive launcher icons were first introduced in Android version 8.0 (Oreo) API Level 26. tNavigationIcon(R.drawable.ic_arrow_back_white_24dp) Creating an adaptive Icon for Android using Android Studio is relatively easybut before we jump into an implementation, let’s first take a closer look at what an adaptive icon actually is. Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar) Open ( MainActivity.java) file and let’s define the toolbar, set the app name to be shown in the toolbar as well as the back arrow icon like this:.Change the color of the back arrow icon from black to white by adding white color code inside ( android:fillColor) like this:.When you open ( ic_arrow_back_white_24dp.xml) file you will see the following code:.Click on icon where the red arrow is pointing and choose the back arrow icon from the icons list and then click on finish.Click on res and then right click on drawable => New => Vector Asset.Īndroid studio asset studio ( Large preview) Now let’s add the back arrow icon inside android toolbar by using Android asset studio.

Open (styles.xml) file and change the parent theme from ( ) to ( ) like Next let’s add android toolbar, open ( activity_main.xml) file and make the following code changes.Open up Android Studio and create a new project and give it a name, in our case we’ve named it ( ToolbarButtonTutorial), choose API 16 as the minimum SDK, then choose a blank activity and click on finish and wait for Android Studio to build your project.In this tutorial we will be using the following: You can use the android toolbar back button to navigate from one screen to another without having to tap on the actual device back button. Hi and welcome to another tutorial from codingdemos, today you will learn how to create android toolbar back button for your app.
