Android : How can I make the behind view of jeremy feinstein's SlidingMenu clickable

on Thursday, March 19, 2015


I am using jeremy feinstein's SlidingMenu for an Android app. When the left menu is opened, I still have a remaining space from the behind view uncovered. In that remaining view I have a button that I want to handle onClick. But when I click on it or in any other part of the view, it just closes the left menu.


How can I make this work? I tried to set sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN|SlidingMenu.TOUCHMODE_FULLSCREEN); but it didn't work this way. This is the code for my SlidingMenu object:



SlidingMenu sm = getSlidingMenu();
sm.setShadowWidthRes(R.dimen.shadow_width);
sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
sm.setFadeDegree(0.0f);
sm.setMode(SlidingMenu.LEFT_RIGHT);
sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN|SlidingMenu.TOUCHMODE_FULLSCREEN);

// set the left menu
sm.setMenu(R.layout.menu_frame_left);
getSupportFragmentManager().beginTransaction()
.replace(R.id.menu_frame_left, new LeftMenuListFragment())
.commit();

// set the right menu
sm.setSecondaryMenu(R.layout.menu_frame_right);
getSupportFragmentManager().beginTransaction()
.replace(R.id.menu_frame_right, new RightMenuListFragment())
.commit();


I will also attach an image drawn by me to explain better what I am trying to achieve:


enter image description here


0 comments:

Post a Comment