Reputation:
I want while click on FAB button it Open Navigation Drawer.
How to do?
Upvotes: 1
Views: 979
Reputation: 1594
mDrawerLayout = (DrawerLayout) getView().findViewById(R.id.drawer_layout);
and add following line in Fab Onclick
mDrawerLayout.openDrawer(Gravity.LEFT);
Upvotes: 1
Reputation: 9117
You can take a look at this DrawerLayout
mDrawerLayout = (DrawerLayout) getView().findViewById(R.id.drawer_layout);
FloatingActionButton myFab = (FloatingActionButton) myView.findViewById(R.id.myFAB);
myFab.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//if you need open the slide:
mDrawerLayout.openDrawer(Gravity.LEFT);
//if you need close the slide
mDrawerLayout.closeDrawer(Gravity.LEFT);
}
});
Upvotes: 4