I've implemented the ActionBarDrawerToggle with the hamburger icon (support library v7), but for some reason the toggle only displays a 'back' arrow on devices not running 5.0 (I have confirmed this for all 4.x versions). Is this normal behaviour?
The arrow looks like this:
Now the arrow icon doesn't change. It's the same when the navigation drawer is pulled out, or when it is in collapsed mode.
This is how I initalize the drawertoggle etc.
// drawer toggle
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
R.string.drawer_open, R.string.drawer_close);
mDrawerLayout.setDrawerListener(mDrawerToggle);
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setHomeButtonEnabled(true);
EDIT
For some clarification. I am using the old regular ActionBar, not the Toolbar. The hamburger icon DOES show on 5.0 devices but not on < 5.0. Should I use the toolbar to fix this problem?
In order to get the hamburger icon this piece of code below is enough
Toolbar toolbar =(Toolbar)findViewById(R.id.app_bar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowHomeEnabled(true);
it's showing back button because you are using the method setDisplayHomeAsUpEnabled(true);
Check out the official reference Click here
我只是复制drawable并重命名它,如果你想在所有设备上使用它,请使用它。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.