I'm currently using aide to write the app I have alread created the Nav drawer but I don't want to open it with the toggle button in the action bar.
Asked
Active
Viewed 44 times
0
-
1Possible duplicate of [How to show/Hide Navigation Drawer programmatically](https://stackoverflow.com/questions/32583169/how-to-show-hide-navigation-drawer-programmatically) – Mohammad Sianaki Nov 02 '19 at 16:55
1 Answers
0
Button btn = findViewById(R.id.menu_btn);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DrawerLayout drawer = findViewById(R.id.drawer_layout);
if(!drawer.isDrawerOpen(Gravity.START)) drawer.openDrawer(Gravity.START);
else drawer.closeDrawer(Gravity.END);
}
});

private static
- 745
- 8
- 17