Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActionBarDrawerToggle does not open drawer until first slide

I am using Google Design Support Library and DrawerLayout.

Setup:

final DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
NavigationView drawer = (NavigationView) findViewById(R.id.drawer);
if(mDrawerToggle == null) {
    mDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, mToolbar, R.string.open, R.string.feather_close);
    drawerLayout.addDrawerListener(mDrawerToggle);
    mDrawerToggle.syncState();
}

When I start my app, the ripple effect of the hamburger icon is shown but the drawer is not opened. When I open the drawer at least one time by sliding from the left, the hamburger icon works for the entire runtime. I don't have a special listener on the toggle button or the drawer itself and the onOptionsItemSelected method is not called.

Please help me to find out what happens.

Thank you.

like image 559
Denny Weinberg Avatar asked Dec 24 '22 20:12

Denny Weinberg


1 Answers

I found it: I accidentally had android:visibility="gone" in my NavigationView. What a freaky side effect.

like image 141
Denny Weinberg Avatar answered May 08 '23 15:05

Denny Weinberg