Slider Menu both side(right & left) in single Activity
Asked Answered
A

5

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.

Avruch answered 17/4, 2013 at 11:42 Comment(1)
I think you should show some code at least, in order to properly have an idea of what is not working there :)Spock
O
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.

Oneway answered 22/4, 2013 at 3:7 Comment(0)
A
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);
Ankney answered 17/4, 2013 at 12:3 Comment(0)
T
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.

Transfix answered 26/4, 2013 at 6:28 Comment(0)
G
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!

Grishilde answered 26/4, 2013 at 9:26 Comment(0)
A
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/

Aeroembolism answered 11/8, 2015 at 17:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.