I have an Actionbar
from android.support.v7.widget.Toolbar
. It has hamburger image with animation to back arrow, I want to change back arrow from <- to ->. how can I do this in Android Studio?
I read somewhere to change it with setHomeAsUpIndicator()
method, but it change hamburger button and it has no animation to back arrow.
Try this:
There are at least half a dozen ways to do this, but probably the simplest and shortest is to use reflection to grab the
ActionBarDrawerToggle
'sDrawable
, and flip its direction.This example wraps that functionality in a subclass, and should work no matter your
ActionBar
/Activity
setup (provided the original class worked there in the first place).This will only change the direction of the toggle's image. If you actually want the whole
ActionBar
/Toolbar
to be flipped, you should instead change the layout's direction accordingly.Add this condition between
mDrawerToggle = new ActionBarDrawerToggle...
andmDrawerToggle.syncState();
like this :