Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a back item in ActionBar?

I would like the home item look like the back button in the ActionBar in Android 3.0 app. The look is similar to Market app (see the screenshot below marked in red):
enter image description here I know there is a standard method to add an "up" affordance to the home button in action bar. But haven't seen a standard way to add a back arrow. Is there a standard way to do it (maybe subclassing of ActionBar/Activity etc.)? If anyone has an example or has done something like this - it would be very nice if you could share it. Thank you.

UPD: if I use setDisplayHomeAsUpEnabled(true), it adds an up affordance as this - see a tiny up arrow on the left: enter image description here

Maybe there is a way to style this "up" arrow to be a "back" arrow?

like image 823
justadreamer Avatar asked Dec 01 '22 07:12

justadreamer


1 Answers

But haven't seen a standard way to add a back arrow.

That is the "up" affordance. Call setDisplayHomeAsUpEnabled(true) on your ActionBar to toggle it on.

like image 184
CommonsWare Avatar answered Dec 09 '22 15:12

CommonsWare