How to use jfeinstein10/SlidingMenu both sides

236 Views Asked by At

First of all I am sorry to ask repeated questions. As this has been asked before but some how I could not understand properly. I found a good solutions here. I followed and could add library to my project. Now I need to add left and right sliding menus to my project without action-bar. Here is the picture-

enter image description here

If I click any of the selected button then it should open the respective sliding page(once at a time) at the specific sides. Something like -

enter image description here

currently - I am able to generate one side of the menu bar. It is working with sliding only. -

public class MainActivity extends FragmentActivity {
ViewPager viewPager;
PagerAdapter adapter;   
CirclePageIndicator mIndicator; 
private int mWidthScreen;
private int mHeightScreen;  
private Bundle bundle;
private List<Fragment> frgScreens;
private int selectedtheme;
private Handler mHandler = new Handler();

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Get the view from viewpager_main.xml
    setContentView(R.layout.viewpager_main);         

    SlidingMenu menu;
    menu = new SlidingMenu(this);
    menu.setMode(SlidingMenu.LEFT);
    menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    menu.setShadowWidth(5);
    menu.setFadeDegree(0.0f);
    menu.attachToActivity(this,     SlidingMenu.SLIDING_CONTENT);
    menu.setBehindWidth(500);
    menu.setMenu(R.layout.menu_frame);
}

Now I want in both sides and should open menu by clicking the button

Any help will be appreciated. Please feel free to ask any queries.

1

There are 1 best solutions below

0
On BEST ANSWER

Well Finally I did it. Here mBtnMenu is an ImageView.

mBtnMenu = (ImageView) findViewById(R.id.btnMenu);

menu = new SlidingMenu(this);
menu.setMode(SlidingMenu.LEFT);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menu.setShadowWidth(5);
menu.setFadeDegree(0.0f);
menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
menu.setBehindWidth(500);
menu.setMenu(R.layout.menu_frame);

mBtnMenu.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View arg0) {
        // menu.showMenu();

        menu.toggle();

    }
});