Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Navigation Drawer icon on the top right is showing Back arrow icon insted of Hamburger icon

I have Create a new android app with the Navigation Drawer Activity. When i execute the app, the icon on the right corner is showing the back Arrow but it has to be the 3 line's icon.

The icon R.drawable.ic_drawer is this

enter image description here

In NavigationDrawerFragment class.

// ActionBarDrawerToggle ties together the the proper interactions
    // between the navigation drawer and the action bar app icon.
    mDrawerToggle = new ActionBarDrawerToggle(
            getActivity(),                    /* host Activity */
            mDrawerLayout,                    /* DrawerLayout object */
            R.drawable.ic_drawer,             /* nav drawer image to replace 'Up' caret */
            R.string.navigation_drawer_open,  /* "open drawer" description for accessibility */
            R.string.navigation_drawer_close  /* "close drawer" description for accessibility */
    ) 

When i execute the App i'm getting Arrow icon on the right.

enter image description here

After the selection also the Icon is same.

enter image description here

how do i change it now ?

like image 637
Uday Avatar asked May 06 '15 08:05

Uday


People also ask

How do I add a burger menu to Kotlin?

Create a new Project in android studio. app > res > right-click > new > Directory > enter name (menu) > Enter. app > res > menu > right-click > new > menu resource file (drawer_items) > OK. <?


1 Answers

Hope this helps, I solved the above problem this way. @shkschneider is right. To make your code work import android.support.v7.app.ActionBarDrawerToggle

mDrawerToggle = new ActionBarDrawerToggle(this,
                mDrawerLayout,
                R.string.drawer_open,
                R.string.drawer_close){

            @Override
            public void onDrawerClosed(View drawerView) {
                getSupportActionBar().setTitle(mTitle);
                invalidateOptionsMenu();
            }

            @Override
            public void onDrawerOpened(View drawerView) {
                getSupportActionBar().setTitle(mDrawerTitle);
                invalidateOptionsMenu();
            }
        };
like image 87
Sagar Devanga Avatar answered Oct 14 '22 10:10

Sagar Devanga