Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open Drawer Layout only with button?

I'm working on application that has a tab structure, and use sliding movements to move through the tabs.

But now, I want to apply Drawer Layout. The problem is that the Drawer has slide to open events. How I can delete this event? My idea was that the Drawer only could open and close with a button. Is this possible? Thanks!

like image 673
pgarriga Avatar asked Aug 09 '13 07:08

pgarriga


People also ask

How do I open a navigation drawer?

The user can view the navigation drawer when they swipe a finger from the left edge of the activity. They can also find it from the home activity (the top level of the app) by tapping the app icon (also known as the Android "hamburger" menu) in the action bar.

How do I open the navigation drawer on button click in react native?

React Native Drawer Navigation Example Add these screens to createStackNavigator and add "md-menu" icon of 'react-native-vector-icons/Ionicons' package. On pressing the menu icon, call navigation. openDrawer() method to open drawer.

How do I make a custom navigation drawer?

Android App Development for BeginnersStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml. Step 3 − Add the following code to res/layout/nav_header_main.


1 Answers

Just write

drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);

to prevent menu from listening to gesture

and use openDrawer and closeDrawer to change menu visibility

like image 84
Maxim Efimov Avatar answered Oct 21 '22 04:10

Maxim Efimov