DrawerLayout.openDrawer does not work the first time

I had the same issue and I've just found out that for some reason the FrameLayout that represents the drawer have the visibility set to "gone", that probably goes to "visible" during the first slideGesture.

So, open your layout xml file, locate your FrameLayout that represents the drawer and simply erase the visibility setting. My opening tag is now as follows:

<FrameLayout
    android:layout_width="305dp"
    android:layout_height="match_parent"
    android:layout_gravity="start">

That worked for me.

Cheers


In my case the visibility on 'NavigationView' was set to gone in the layout. Changing it to visible solved the issue


If you want to open it from the Top Left Toggle you should implement onOptionsItemSelected(MenuItem item)

@Override
public boolean onOptionsItemSelected(MenuItem item) {
     // The action bar home/up action should open or close the drawer.
     // ActionBarDrawerToggle will take care of this.
    if (mDrawerToggle.onOptionsItemSelected(item)) {
        return true;
    }

    switch (item.getItemId()) {
    case android.R.id.home:
        return true;
    }
   return super.onOptionsItemSelected(item);
}