原文地址:
https://stackoverflow.com/a/37185334
I think onSupportNavigateUp() is best and Easiest way to do so
check the code below
if you want it programmatically Add this line in onCreate() method
1 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); |
Note: make sure Actionbar is not null.
And Override this method
1 |
|
thats it
OR Non-programmatically you can add meta to the activity in manifest file as
1 | <meta-data |
Other solution:
1 | mToolbar.setNavigationOnClickListener(new View.OnClickListener() { |