I'm migrating from ActionBar
to Toolbar
in my application.
But I don't know how to display and set click event on Back Arrow on Toolbar
like I did on Actionbar
.
With ActionBar
, I call mActionbar.setDisplayHomeAsUpEnabled(true)
.
But there is no the similar method like this.
Has anyone ever faced this situation and somehow found a way to solve it?
If you don't want to create a custom
Toolbar
, you can do like thisIn you
AndroidManifest.xml
you can also put this
android:theme="@style/Theme.AppCompat.Light"
to<aplication>
tag, for apply to all activitiesI see a lot of answers but here is mine which is not mentioned before. It works from API 8+.
In the
AppCompatActivity
for example you can doSimple and easy way to show back button on toolbar
Paste this code in onCreate method
Paste this override method outside the onCreate method
In Kotlin it would be