Skip to content Skip to sidebar Skip to footer

Keep Navigation Drawer Open

I'm building an app where I want to show some additional information in the navigation drawer but after clicking inside of the navigation drawer it closes by default and I would l

Solution 1:

    DrawerLayout drawerLayout; // Global variable

    drawerLayout = findViewById(R.id.drawer_layout);
    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.syncState();


        drawerLayout.openDrawer(GravityCompat.START); // Use this line of code where you want to keep open the drawerLayout. 

If you still have problem to understand please let me know.


Post a Comment for "Keep Navigation Drawer Open"