Toolbar Navigation Hamburger Icon missing

android navigation drawer hamburger icon not showing
androidx navigation drawer
change hamburger icon android
how to open navigation drawer on button click in android studio
android add navigation drawer to existing activity
navigation view android
android navigation drawer item click
hide hamburger icon android

I'm looking for a way to display the hamburger icon whitout using the Drawer/DrawerToggle and use the default icon included in Android

By setting getSupportActionBar().setDisplayHomeAsUpEnabled(true); it display the back arrow but not the hambuerger. Other post on Stackoverflow (like this or this) use the DrawerLayout or a custom drawable. I cannot find the vector or png for the hamburger icon on the Android source.

Do you know how can I find the original hamburger icon in android/support library? (or how to displayed it)

Note: Vector and png can be found on google.com/design website : http://www.google.com/design/spec/resources/sticker-sheets-icons.html#

In my activity

mToolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);

mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        Log.d(LOG_TAG, "navigation clicked");
    }
});

Layout file

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:minHeight="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    app:theme="@style/ThemeOverlay.AppCompat.ActionBar"/>

Styles.xml

<!-- Base application theme. -->
<style name="Theme.AppTheme" parent="Theme.AppCompat.Light.NoActionBar">


    <item name="colorPrimary">@color/primaryDef</item>
    <item name="colorPrimaryDark">@color/primaryDarkDef</item>
    <item name="colorAccent">@color/primaryDef</item>

    <!-- Remove the actionbar shadow-->
    <item name="android:windowContentOverlay">@null</item>
</style>

If you want to use the same drawer as lollipop then let me tell you that's not a static image. That image is drawn in real time by a class called DrawerArrowDrawableToggle. So there is no "hamburger" icon for that.

However if you want the hamburger icon with no animation you can find it here:

https://material.io/tools/icons/?icon=menu&style=baseline

android - Toolbar Navigation Hamburger Icon missing, If you want to use the same drawer as lollipop then let me tell you that's not a static image. That image is drawn in real time by a class called  android - studio - Toolbar Navigation Hamburger Icon missing how to change navigation drawer icon in android studio (10) I'm looking for a way to display the hamburger icon whitout using the Drawer/DrawerToggle and use the default icon included in Android

To have an animated hamburger icon you should use DrawerLayout with ActionBarDrawerToggle and enable the icon for the ActionBar and for the ActionBarDrawerToggle.

Example:

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle mDrawerToggle;

setSupportActionBar(toolbar);
final ActionBar actionBar = getSupportActionBar();

if (actionBar != null)
{
   actionBar.setDisplayHomeAsUpEnabled(true);
   mDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.hello_world, R.string.hello_world)
   {

      public void onDrawerClosed(View view)
      {
         supportInvalidateOptionsMenu();
         //drawerOpened = false;
      }

      public void onDrawerOpened(View drawerView)
      {
         supportInvalidateOptionsMenu();
         //drawerOpened = true;
      }
   };
   mDrawerToggle.setDrawerIndicatorEnabled(true);
   drawerLayout.setDrawerListener(mDrawerToggle);
   mDrawerToggle.syncState();
}

Also, you need to add these methods to your Activity:

@Override
protected void onPostCreate(Bundle savedInstanceState)
{
    super.onPostCreate(savedInstanceState);
    mDrawerToggle.syncState();
}

@Override
public void onConfigurationChanged(Configuration newConfig)
{
    super.onConfigurationChanged(newConfig);
    mDrawerToggle.onConfigurationChanged(newConfig);
}

Hamburger icon missing on custom toolbar, but tapping upper left , You have to use ActionBarDrawerToggle to achieve your requirement. Please try to update your existing code as below, public class LoginActivity extends  Pressing the 3 horizontal bars does not restore the left navigation bar. QuickBooks Team. ‎07-17-2019 09:37 AM. Subscribe to RSS Feed. Email to a Friend. Report Inappropriate Content. Re: How do get the left navigation bar back? It is missing. If pressing the 3 bars icon does not restore the left navigation menu, I suggest clearing the

For that you just need write to some lines

   DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
   ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
   drawer.addDrawerListener(toggle);
   toggle.setDrawerIndicatorEnabled(true);
   toggle.syncState();

toggle.setDrawerIndicatorEnabled(true); if this is false make it true or remove this line

Update UI components with NavigationUI, https://developer.android.com › reference › android › support › app › Acti In this video, we'll create Toolbar with Hamburger Icon for Navigation Drawer. All the in the video is on Github, here is the link. Github Repository Link: h

You can try to make your own drawable for the hamburger icon like this.

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportHeight="24.0"
    android:viewportWidth="24.0">
    <path
        android:fillColor="#ffffff"
        android:pathData="M3,18h18v-2L3,16v2zM3,13h18v-2L3,11v2zM3,6v2h18L21,6L3,6z" />
</vector>

Then in your fragment/activity,

getSupportActionBar().setHomeAsUpIndicator(R.drawable.as_above);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);

For other drawables, this might help: https://github.com/google/material-design-icons/blob/master/navigation/drawable-anydpi-v21/

ActionBarDrawerToggle, Using this constructor will set Toolbar's navigation click listener to toggle the drawer when it is clicked. This drawable shows a Hamburger icon  Inform the Toolbar to provide back navigation. This will set the icon to the default material icon. getSupportActionBar().setDisplayHomeAsUpEnabled(true); Later override the icon with the custom one, in my case the Holo back icon. toolbar.setNavigationIcon(R.drawable.ic_chevron_left_white_36dp);

Here is the simplest solution that worked for me.

The ActionBarDrawerToggle has two types constructors. One of them take toolbar as a parameter. Use that (second one below) to get the animated hamburger.

ActionBarDrawerToggle(this, mDrawerLayout, R.string.content_desc_drawer_open, 
R.string.content_desc_drawer_close);

ActionBarDrawerToggle(this, mDrawerLayout, toolbar, R.string.content_desc_drawer_open, 
R.string.content_desc_drawer_close);`  //use this constructor

No Hamburger to Arrow animation or icon showing on Drawer , Appcompatv7 - v21 Navigation drawer not showing hamburger icon Main); mToolbar = FindViewById<SupportToolbar>(Resource.Id.toolbar);  Toolbar Navigation Hamburger Icon missing. By setting getSupportActionBar().setDisplayHomeAsUpEnabled(true); it display the back arrow but not the hambuerger. Other post on Stackoverflow (like this or this) use the DrawerLayout or a custom drawable. I cannot find the vector or png for the hamburger icon on the Android source.

Display the Thunderbird menus and toolbar, The menu items File, Edit, View, etc. are located in the menu bar. This article will help you restore a missing menu bar. Navigation Drawer with Fragments Part 1 - MENU AND ACTIVITY THEME - Android Studio Tutorial - Duration: 10:35. Coding in Flow 453,576 views

Fragment Navigation Drawer, <menu xmlns:android="http://schemas.android.com/apk/res/android"> <group Create a new layout file res/layout/toolbar.xml with the following code: I use a Master-Detail-Navigation (provided by FreshMvvm but I think that is not the point). The buttons are "there" and can be clicked. Only the icon is missing. Then, when I for example tick the hamburger menu (without invoking any real navigation) the icons get visible. Android is working. The toolbar items are defined in XAML.

App bars: top, It's used for branding, screen titles, navigation, and actions. It can transform Top app bars appear at the top of each screen in an app, and can disappear upon scroll. Contextual top app bar with menu icon and page title on left, and favorite,.

Comments
  • possible duplicate of Appcompatv7 - v21 Navigation drawer not showing hamburger icon
  • @PedroOliveira it's not a duplicate because I explcitly sayed I didn't use ActionBarDrawerToggle
  • Then if you're not using a drawer how are you supposed to show a menu? That hamburger icon is part of the drawer.
  • @PedroOliveira this is not the main question, but it is not used to show a manu. I know it's against the UX Guidlines and it will not be in a public app. The question is just to find the icon inside Android if it's possible.
  • @ASP this do not answer the question
  • Your answer complete 50% of the question, thank you ! Do you know a way to implement this for pre-lolipop device ?
  • If you want to achive that nice animation with the hamburger menu I suggest you look up appcompatv7 for that and set up a drawer menu. If you want to just show the menu icon then just place the image inside the drawables and use it. I will post here my repo with a nice and simple template on "Material Drawer" that works on pre-lollipop devices :) github.com/kanytu/android-material-drawer-template
  • thank you, can you comlete your answer to include google.com/design/spec/resources/… where we can also find official icons. Not that vector icon requires API 21, so we have to use png
  • Friend on that site you just have to click "Download ZIP" and it will download all the png's with the same drawable folder structure android project uses :) Just go there. Select your favorite color, click download zip, and drag that "res" folder into your own "res" folder :)
  • Edited. Does that do the job? :)
  • Doesn't work indeed... until I realized the missing drawerLayout.syncState to make the hamburger icon appear :)
  • @ptitvinou, see updated answer. I add missing methods.