10

I want slide Menu in both side(right & left) on single Activity

on Button click like below

enter image description here

i have tried this two library

https://github.com/jfeinstein10/SlidingMenu/

and

https://github.com/SimonVT/android-menudrawer

but both are give slide Menu only right or left side.

  • I think you should show some code at least, in order to properly have an idea of what is not working there :) – a.bertucci Apr 20 '13 at 18:05

5 Answers5

15

Yep Analizer has it right with setmode. Here's an example from jfeinstein10 library. Controlling the left menu with setMenu.. and the right with setSecondary...

https://github.com/jfeinstein10/SlidingMenu/blob/master/example/src/com/slidingmenu/example/LeftAndRightActivity.java

package com.slidingmenu.example;

import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;

import com.slidingmenu.example.fragments.ColorFragment;
import com.slidingmenu.lib.SlidingMenu;
import com.slidingmenu.lib.SlidingMenu.OnClosedListener;
import com.slidingmenu.lib.SlidingMenu.OnOpenedListener;


public class LeftAndRightActivity extends BaseActivity {

public LeftAndRightActivity() {
    super(R.string.left_and_right);
}

 @Override
 public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getSlidingMenu().setMode(SlidingMenu.LEFT_RIGHT);
    getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);

    setContentView(R.layout.content_frame);
    getSupportFragmentManager()
    .beginTransaction()
    .replace(R.id.content_frame, new SampleListFragment())
    .commit();

    getSlidingMenu().setSecondaryMenu(R.layout.menu_frame_two);
    getSlidingMenu().setSecondaryShadowDrawable(R.drawable.shadowright);
    getSupportFragmentManager()
    .beginTransaction()
    .replace(R.id.menu_frame_two, new SampleListFragment())
    .commit();
 }

}

Make sure to get a clean and updated copy of the library as well. Just in case.

Chris Dinon
  • 566
  • 4
  • 6
5

I'm using the one at https://github.com/jfeinstein10/SlidingMenu/ and it works fine on both sides. Don't forget to set this to make it working:

getSlidingMenu().setMode(SlidingMenu.LEFT_RIGHT);
Analizer
  • 1,594
  • 16
  • 30
4

Using SimonVT's MenuDrawer you can achieve sliding menu on both sides using two menuDrawer instances as follows

leftmenu = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_WINDOW);
rightmenu = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_WINDOW,Position.RIGHT); 

for button click please refer the examples in the library.

sooraj.e
  • 766
  • 2
  • 11
  • 26
0

I think you can use https://github.com/jfeinstein10/SlidingMenu/ to achieve it.You should watch the demo.There is a left and right demo in it.Good luck!

Marshal Chen
  • 1,985
  • 4
  • 24
  • 35
0

Just adding to sooraj.e's answer, since it didn't worked for me at Simon VT's MenuDrawer last release.

This is working fine on it's last version (unfortunately deprecated)

mDrawerLeft = MenuDrawer.attach(MainActivity.this,
MenuDrawer.Type.BEHIND, Position.LEFT, MenuDrawer.MENU_DRAG_WINDOW);
mDrawerLeft.setDropShadowEnabled(false);
mDrawerLeft.setContentView(R.layout.activity1);
mDrawerLeft.setMenuView(R.layout.menu1);

mDrawerRight = MenuDrawer.attach(MainActivity.this, 
MenuDrawer.Type.BEHIND, Position.RIGHT, MenuDrawer.MENU_DRAG_WINDOW);
mDrawerRight.setDropShadowEnabled(false);
mDrawerRight.setContentView(R.layout.activity1);
mDrawerRight.setMenuView(R.layout.menu2);

Library link: https://github.com/SimonVT/android-menudrawer/

Machado
  • 14,105
  • 13
  • 56
  • 97