I want slide Menu in both side(right & left) on single Activity
on Button click like below
i have tried this two library
https://github.com/jfeinstein10/SlidingMenu/
and
https://github.com/SimonVT/android-menudrawer
I want slide Menu in both side(right & left) on single Activity
on Button click like below
i have tried this two library
https://github.com/jfeinstein10/SlidingMenu/
and
https://github.com/SimonVT/android-menudrawer
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...
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.
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);
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.
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!
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/
© 2022 - 2024 — McMap. All rights reserved.