0

I'm using the sliding menu library here: https://github.com/jfeinstein10/SlidingMenu/ and I have an activity that inherits from SlidingMenuActivity with a sliding menu that works perfectly, but I also want to add SlidingMenus to each row in a list fragment that is shown as part of this SlidingMenuActivity subclass. It seems that the way I'm doing it doesn't work at all; the touches get intercepted and they don't let me click on a list row, but I can't swipe the sliding menu into appearance, nor can I see the SlidingMenu when it's closed.

This is the code that I'm using to add the sliding menu to each list row:

private void makeSlidingMenu(View view) {
    FrameLayout menuClosedFrame = // ... the above view

    RelativeLayout menuLayout = // ... the behind view

    SlidingMenu slidingMenu = new SlidingMenu(view.getContext());
    slidingMenu.setContent(menuClosedFrame);
    slidingMenu.setMenu(menuLayout);
    slidingMenu.setBackgroundColor(Color.RED);
    slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    slidingMenu.setTouchModeBehind(SlidingMenu.TOUCHMODE_FULLSCREEN);
    slidingMenu.setBehindScrollScale(1.0f);
    slidingMenu.setFadeDegree(0.0f);

    RelativeLayout layout = (RelativeLayout)view;
    layout.addView(slidingMenu, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT) {{
        addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
        addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
        addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
        addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
    }});
}

It's not pretty, but it seems to get the job done on a normal activity that doesn't have a list view and is not a SlidingMenuActivity. It just doesn't work in a nested scenario with a ListView for me. Is there anything else I could be doing wrong? If posting more code would help let me know. Thanks!

Kevlar
  • 8,804
  • 9
  • 55
  • 81

1 Answers1

0

Figured it out; the way I was adding the sliding menu to the row was causing it to be sized improperly I think; I fixed it by adding it to a framelayout instead that also contains the contents I want to show since i want the cell's main content to remain static.

Kevlar
  • 8,804
  • 9
  • 55
  • 81