2

I have a drawer in my Android App. The drawer has a hamburger icon on the left side of the toolbar. I want to hide the hamburger icon. I use the following code:

mDrawerToggle.setDrawerIndicatorEnabled(false); 

The hamburger disappear, however, there is still a white space left, as is shown in the following img.

Here is the hamburger, an icon for drawer there is still a white space on the left side of Toolbar

How can I make the white space disappear?

2
  • what is the 'hamburger' icon. Please show/highlight the icon, so that we can remove ambiguity. Commented Feb 18, 2016 at 18:42
  • 1
    Can you show us your XML layout? Are you using a custom ToolBar? Commented Feb 18, 2016 at 18:49

1 Answer 1

5

set your toolbar navigation icon to null.

 toolbar.setNavigationIcon(null); 

Refer doc it says

Parameters icon
Drawable to set, may be null to clear the icon

------------Update----------

If results remain same then create drawable of the color which is background of your toolbar. And set it as navigation icon.This hack should work.

naviation_drawable_icon.xml

<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <solid android:color="YOUR_COLOR_CODE"/> </shape> 

toolbar.setNavigationIcon(R.drawable.naviation_drawable_icon).

Sign up to request clarification or add additional context in comments.

1 Comment

Same result, hamburger disappear, but a white space still there.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.