** A slide-out menu implementation, which allows users to navigate between views in your app.

Overview

MenuDrawer

A slide-out menu implementation, which allows users to navigate between views in your app. Most commonly the menu is revealed by either dragging the edge of the screen, or clicking the 'up' button in the action bar.

Features

  • The menu can be positioned along all four edges.
  • Supports attaching an always visible, non-draggable menu, which is useful on e.g. tablets.
  • The menu can wrap both the content and the entire window.
  • Allows the drawer to be opened by dragging the edge, the entire screen or not at all.
  • Can be used in XML layouts.
  • Indicator that shows which screen is currently visible.

Usage

This library is very simple to use. It requires no extension of custom classes, it's simply added to an activity by calling one of the MenuDrawer#attach(...) methods.

For more examples on how to use this library, check out the sample app.

Left menu

public class SampleActivity extends Activity {

    private MenuDrawer mDrawer;

    @Override
    protected void onCreate(Bundle state) {
        super.onCreate(state);
        mDrawer = MenuDrawer.attach(this);
        mDrawer.setContentView(R.layout.activity_sample);
        mDrawer.setMenuView(R.layout.menu_sample);
    }
}

Right menu

public class SampleActivity extends Activity {

    private MenuDrawer mDrawer;

    @Override
    protected void onCreate(Bundle state) {
        super.onCreate(state);
        mDrawer = MenuDrawer.attach(this, Position.RIGHT);
        mDrawer.setContentView(R.layout.activity_sample);
        mDrawer.setMenuView(R.layout.menu_sample);
    }
}

Including in your project

Either include it in your project as an android library project, or use gradle to grab it from maven central:

compile 'net.simonvt.menudrawer:menudrawer:{latest-version}'

Credits

  • Cyril Mottier for his articles on the pattern

License

Copyright 2012 Simon Vig Therkildsen

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • Rendering problem when used with Google Maps Android API v2

    Rendering problem when used with Google Maps Android API v2

    If there is map (v2) inside content area sliding menu is not rendered and you see just a black background.

    I have faced that issue on Galaxy S3 and many other 2.3 phones. However on Galaxy Nexus with 4.2 everything is ok.

    I have attached screenshot that illustrates the problem. map_problem

    opened by lexer 25
  • Add Custom support for ViewPager

    Add Custom support for ViewPager

    Hello,

    I've added two methods to customize the touch behavior:

    • setDragBezelFullScreen (Set the touch area to full width)
    • setDragBezelEnabled (Enable/disable dragging)

    This is useful when using with a ViewPager in the content view and allow to reproduce the Verge app behavior.

    How to: When using the menu with a ViewPager, set setDragBezelFullScreen to true If the View pager current position is the first page call setDragBezelEnabled to true otherwise set setDragBezelEnabled to false.

    Thank you for this awesome library!

    Nicolas

    opened by niqo01 17
  • Change menu height

    Change menu height

    Hey man, how is it going? How can I change the height of a right side menu drawer? I'm not using any action bar (v4 support lib/sherlock/etc...) but I do have my own layout as an action bar. All I want to do is to set my right side (screen right - opens from right to left) menu to be below my own custom action bar. Can't find it inside your code.

    Is it possible?

    Thanks!

    opened by MarkySmarky 14
  • I want to creat the menu like app of path on ios . left menu  and right menu

    I want to creat the menu like app of path on ios . left menu and right menu

    Hey Simon/Jake

    First of all, thanks for sharing your app menu drawer implementation.

    I want to creat the menu like app of path on ios . that have two menu for left and right in the mainactiviy in the theam time.

    But in your code,i found : public MenuDrawerManager(Activity activity, int dragMode, int gravity) { mActivity = activity; mDragMode = dragMode;

        mMenuDrawer = gravity == MenuDrawer.MENU_POSITION_RIGHT ? new RightDrawer(activity) : new LeftDrawer(activity);
    

    so, that's mean :your library can not do that. ? Thanks/

    opened by liufsd 13
  • menudrawer with activities and fragments

    menudrawer with activities and fragments

    I was wondering if you have an example of how to integrate your library with existing projects that contain multiple activities and use fragments. For instance, in your Content Change example, when an item on the left is selected, the textView is set on the right. However, how do I handle the case when I need to create an activity for each menu item selection and display that activity on the right? This scenario is closer to real world apps and an example may help faster adoption of your excellent library!

    Any help is greatly appreciated.

    opened by avenkatesan 12
  • [Feature Request] Add a way to have

    [Feature Request] Add a way to have "holes" in TOUCH_MODE_FULLSCREEN

    Hi,

    It would be cool if there's an easy way to disable the allowdrag for certain zone when in TOUCH_MODE_FULLSCREEN.

    For Viewpager for example we can override canScroll.

    This may be needed for screen that contains seekbar or custom gesture zone that currently can't pass over this menu.

    I think the same way as viewpager would be enough.

    opened by Tolriq 12
  • [Q] Active position on static view (Activity)

    [Q] Active position on static view (Activity)

    Hi,

    This is probably an easy question. I'm using your library and I'm happy with it. The only thing is not working for me (read: probably I'm doing something wrong or it is not possible) is active indicator.

    I'm using Activities (I'm planning to migrate with my app to fragments). Is is possible to show indicator as selected on creating acitivy?

    I want to open activity and for example - if it's Activity#1 - set active position to item number one etc... I know position of the menu while creating activiy.

    For example: mMenuDrawer.setActiveView(mMenuDrawer.getMenuView(), 1);

    is not working.

    I'm using menudrawer based on .xml file.

    I've checked your sample but I don't know what could be wrong.

    opened by adek 11
  • First Item Cutted

    First Item Cutted

    When i implement a menu bassed on scrollview, some times the was moved little up and the first item was cutted imposibiliting the correct use of the menu.

    opened by franrx 11
  • Glitches while opening menu-drawer

    Glitches while opening menu-drawer

    Hello, first of all great job !!

    I am using menu drawer with a custom layout as

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
        android:id="@+id/activity_dashboard_menu_drawer_view"
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    
    <TextView android:id="@+id/activity_dashboard_login_category"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:drawableLeft="@drawable/facebook_menudrawer_icon"
              android:text="@string/activity_dashboard_login_category"
              style="@style/MenuDrawerCategoryStyle"/>
    
    <LinearLayout
            android:id="@+id/activity_dashboard_menu_drawer_app_category_filter"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
    
    </LinearLayout>
    
    <main.java.com.appsurfer.views.components.MenuView
            android:id="@+id/activity_dashboard_menu_drawer_menu_view"
            android:layout_width="match_parent"
            android:layout_height="fill_parent"/>
    

    And in code i use a custom base list adapter to update the elements of the menudrawer

     private void prepareMenuDrawer() {
        // Initialize menu drawer manager
        mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_CONTENT);
        mMenuDrawer.setContentView(R.layout.activity_dashboard);
        // initialize menu view
        LinearLayout menuDrawerLayout = (LinearLayout) getLayoutInflater().inflate(R.layout.activity_dashboard_menu_drawer_view, null);
        MenuView menuView = (MenuView) menuDrawerLayout.findViewById(R.id.activity_dashboard_menu_drawer_menu_view);
        menuView.setAdapter(getMenuListAdapter());
        menuView.setOnScrollChangedListener(new MenuView.OnScrollChangedListener() {
            @Override
            public void onScrollChanged() {
                mMenuDrawer.invalidate();
            }
        });
        // Initialize menu drawer manager
        mMenuDrawer.setMenuView(menuDrawerLayout);
    }
    
    
    private MenuListAdapter getMenuListAdapter() {
        MenuListAdapter menuListAdapter = new MenuListAdapter(mContext, mHandler);
        // creating array list of menu
        ArrayList<MenuItem> menuItems = new ArrayList<MenuItem>();
        menuItems.add(new MenuItem(0, "Login", 0, MenuItem.MenuItemType.CATEGORY));
        menuItems.add(new MenuItem(1, "Title", 0, MenuItem.MenuItemType.TITLE));       
        return menuListAdapter;
    }
    

    But with this code, there is a visible hick up while opening and closing the menu drawer. I mean if i am opening the menu bar at the start it stops and then the movement is fine and smooth.

    I thought it might be because of adapter, but without setting the adapter if I open a blank menu drawer still issue is there. I am building for the min sdk 8 and target sdk 12. Can you help me on this ?

    opened by akshaydeo 10
  • Use fragments as menu and content?

    Use fragments as menu and content?

    How would one use fragments for the menu and the content? Is it doable with the library? Or is it maybe easy to modify the library to play nice with fragments?

    The library is really cool but if I can't use it with fragments, I really don't see its usefulness.

    opened by kaciula 10
  • [Feature request] Both left and right menu drawers

    [Feature request] Both left and right menu drawers

    Hello,

    It would be great if could use simultaneously on the same Activity a LeftDrawer and a RightDrawer. Simple to ask, maybe be more difficult to implement ;)

    opened by g123k 10
  • How to remove MenuDrawer from my rootView

    How to remove MenuDrawer from my rootView

    Hello all,

    How i can remove the MenuDrawer From my rootView ?? i use like this.

    ViewGroup rootView = (ViewGroup) ((ViewGroup) this.activity.findViewById(android.R.id.content)).getChildAt(0);

    menuDraw.setContentView(rootView);

    • how i can remove it from my rootView i nned to romove it don't need use "TOUCH_MODE_NONE" because i need to twitch between MENU_DRAG_CONTENT & MENU_DRAG_WINDOW

    • my problem when i attach to window : " attachToDecor " the old menu still in the decor how i can remove it ?

    ????? Why this method not clear the previous menu: ????

    private static void attachToDecor(Activity activity, MenuDrawer menuDrawer) {
        ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
        ViewGroup decorChild = (ViewGroup) decorView.getChildAt(0);
    
        decorView.removeAllViews();
        decorView.addView(menuDrawer, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    
        menuDrawer.mContentContainer.addView(decorChild, decorChild.getLayoutParams());
    }
    

    best regard

    opened by AskMeCode 0
  • Noclass definition found

    Noclass definition found

    MenuDrawer mDrawer;

    mDrawer = MenuDrawer.attach(Temp.this); // mDrawer.setContentView(R.layout.activity_sample); mDrawer.setMenuView(R.layout.temp_navigation);

        mImageView = (ImageView) findViewById(R.id.left_drawer_image);
    
        mImageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mDrawer.openMenu();
            }
        });
    

    I have done above code in onCreate() method of Temp.java Activity. and i have the error like

    java.lang.NoClassDefFoundError: net.simonvt.menudrawer.R$attr at net.simonvt.menudrawer.MenuDrawer.(MenuDrawer.java:542) at net.simonvt.menudrawer.MenuDrawer.(MenuDrawer.java:538) at net.simonvt.menudrawer.MenuDrawer.(MenuDrawer.java:531) at net.simonvt.menudrawer.DraggableDrawer.(DraggableDrawer.java:159) at net.simonvt.menudrawer.SlidingDrawer.(SlidingDrawer.java:15) at net.simonvt.menudrawer.MenuDrawer.createMenuDrawer(MenuDrawer.java:491) at net.simonvt.menudrawer.MenuDrawer.attach(MenuDrawer.java:456) at net.simonvt.menudrawer.MenuDrawer.attach(MenuDrawer.java:442) at net.simonvt.menudrawer.MenuDrawer.attach(MenuDrawer.java:419) at net.simonvt.menudrawer.MenuDrawer.attach(MenuDrawer.java:408) at com.waycreon.UserApp.Temp.onCreate(Temp.java:78) at android.app.Activity.performCreate(Activity.java:5133) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) at android.app.ActivityThread.access$600(ActivityThread.java:141) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5103) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method)

    opened by crashfiredeep 0
  • drawer item one is to show and another hide

    drawer item one is to show and another hide

    i want to hide log out and manage profile in drawer item, when i logged in, then show log out and manage profile drawer item and when i logged out ,then hide log out and manage profile item in drawer plz provide me solution thanks

    opened by deepeshsinghbhadoriya 0
🚀 A very customizable library that allows you to present menu items (from menu resource and/or other sources) to users as a bottom sheet.

SlidingUpMenu A library that allows you to present menu items (from menu resource and/or other sources) to users as a bottom sheet. Gradle Dependency

Rasheed Sulayman 26 Jul 17, 2022
An Android library that allows you to easily create applications with slide-in menus. You may use it in your Android apps provided that you cite this project and include the license in your app. Thanks!

SlidingMenu (Play Store Demo) SlidingMenu is an Open Source Android library that allows developers to easily create applications with sliding menus li

Jeremy Feinstein 11.1k Dec 21, 2022
An Android Library that allows users to pull down a menu and select different actions. It can be implemented inside ScrollView, GridView, ListView.

AndroidPullMenu AndroidPullMenu is an Open Source Android library that allows developers to easily create applications with pull menu. The aim of this

Armando TBA 181 Nov 29, 2022
Floating Action Menu for Android. Inspired by the Google Plus floating menu

android-floating-action-menu Floating Action Menu for Android. Inspired by the Google Plus floating menu. Demo Setup The simplest way to use this libr

Alessandro Crugnola 242 Nov 10, 2022
Classic Power Menu is a Power Menu Replacement for Android 11+

Classic Power Menu is a Power Menu Replacement for Android 11+, with the main aim being restoring power menu options (Device Controls & Quick Access Wallet) on Android 12.

Kieron Quinn 385 Dec 31, 2022
Implementation of "Side Navigation" or "Fly-in app menu" pattern for Android (based on Google+ app)

Android SideNavigation Library Implementation of "Side Navigation" or "Fly-in app menu" pattern for Android (based on Google+ app). Description The Go

Evgeny Shishkin 319 Nov 25, 2022
A powerful & customizable menu implementation for android.

A powerful & customizable menu implementation for android. It supports any level of nested menu structures along with custom header and footer views, and much more. Follow the steps below to import the library to your project. You will also find some sample codes.

Nowrose Muhammad Ragib 5 Nov 8, 2022
A menu which can ... BOOM! - Android

BoomMenu 2.0.0 Comes Finally Approximately 8 months ago, I got an inspiration to creating something that can boom and show menu, which I named it Boom

Nightonke 5.8k Dec 27, 2022
An android custom view which looks like the menu in Path 2.0 (for iOS).

ArcMenu & RayMenu ArcMenu An android custom view which looks like the menu in Path 2.0 (for iOS). RayMenu About The user experience in Path 2.0 (for i

daCapricorn 1.3k Nov 29, 2022
You can easily add awesome animated context menu to your app.

ContextMenu You can easily add awesome animated context menu to your app. Check this project on dribbble Check this project on Behance Usage: For a wo

Yalantis 3.8k Dec 28, 2022
Navigation menu for Android (based off Google+ app)

RibbonMenu Navigation menu for Android (based on Google+ app). Usage Menus are created in xml as normal, adding text and an icon. In the layout you wa

David Scott 487 Nov 24, 2022
Android-NewPopupMenu 3.9 0.0 Java is an android library to create popup menu with GoogleMusic app-like style.

Android-NewPopupMenu Android-NewPopupMenu is an android library to create popup menu with GoogleMusic app-like style. Requirements Tested with APIv4 H

u1aryz 159 Nov 21, 2022
An app that helps you create & remove WSA icon in the start menu

WSA Helper An application that allows you to manager WSA's icons in start menus

LSPosed 142 Dec 24, 2022
an animated circular menu for Android

CircularFloatingActionMenu An animated, customizable circular floating menu for Android, inspired by Path app. Getting Started Requirements API >= 15

OÄŸuz Bilgener 2.7k Dec 24, 2022
Side menu with some categories to choose.

Side Menu Side menu with some categories to choose. Check this project on dribbble. Check this project on Behance. God bless Ukraine! Sample Sample &

Yalantis 5.2k Dec 23, 2022
imitate Tumblr's menu, dragging animations look like a snake

android-snake-menu imitate Tumblr's menu, dragging animations look like a snake unexpected episode I found another repository some time ago which impl

stone 586 Nov 10, 2022
:fire: The powerful and easiest way to implement modern material popup menu.

PowerMenu ?? The powerful and easiest way to implement modern material popup menu. PowerMenu can be fully customized and used for popup dialogs. Downl

Jaewoong Eum 1k Dec 29, 2022
Android Satellite Menu

#Satellite Menu 'Path' has a very attractive menu sitting on the left bottom corner of the screen. Satellite Menu is the open version of this menu. Fo

Siyamed SINIR 1.4k Nov 15, 2022