Tim Kranen
Tim Kranen

Reputation: 4222

Android Hamburger icon is an arrow on 4.x

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:

The arrow

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?

Upvotes: 5

Views: 996

Answers (2)

silverFoxA
silverFoxA

Reputation: 4669

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

Upvotes: 1

JCodes13
JCodes13

Reputation: 486

I would just copy the drawable and rename it and use that instead if you want it to be the same on all devices.

Upvotes: 0

Related Questions