androidnavigation-draweractionbardrawertoggle

Android 5.1, ActionBarDrawerToggle not showing the arrow, worked with 5.0 with no code changes


I use the Toolbar as the action bar, DrawerLayout and ActionBardrawerToggle. My min and target SDK is 21. At this point, everything was working fine while my device was running 5.0.1 (API 21). The other day, I got my 5.1 update and the drawer toggle broke - the arrow/hamburger icon is not showing any more. Here is my code:

    setActionBar((Toolbar) findViewById(R.id.toolbar));
    drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.action_open_drawer, R.string.action_close_drawer);
    drawerLayout.setDrawerListener(drawerToggle);

I have the drawerToggle.syncState() in onPostCreate().

Since then I've updated the min and target to 22, along with the compile and build tools to 22 and 22.0.1 respectively, and all support libs I use to 22.0.0, and nothing helped.

Any ideas?


Solution

  • So I managed to get the hamburger/arrow icon to work again. What I did was to add this magic line:

    getActionBar().setDisplayHomeAsUpEnabled(true);
    

    Why it works I have no idea. It seems not to make any sense, the hamburger has nothing to do with the drawer toggle. Or does it?