Skip to content Skip to sidebar Skip to footer

Navigation Drawer Toggle Not Working

This question might have been asked many times, but none of the solutions are working for me. I have an activity that implements navigation drawer but the drawer toggle button is n

Solution 1:

I did followings:

@OverridepublicbooleanonOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will// automatically handle clicks on the Home/Up button, so long// as you specify a parent activity in AndroidManifest.xml.intid= item.getItemId();


    //noinspection SimplifiableIfStatementif (id == R.id.action_settings) {
        returntrue;
    } else {
        DrawerLayoutdrawer= (DrawerLayout) findViewById(R.id.drawer_layout);

        if (drawer.isDrawerOpen(GravityCompat.START)) {
            drawer.closeDrawer(GravityCompat.START);
        } else {
            drawer.openDrawer(GravityCompat.START);
        }
    }



    returnsuper.onOptionsItemSelected(item);
}

and it works OK.

R.id.driver_layout - is my Layout in XML.

Post a Comment for "Navigation Drawer Toggle Not Working"