2

I would like to always display the sliding menu (jfeinstein's slidingmenu) on a tablet, but I would like to do it, without having to "convert" all my activities into fragments (ofcourse, the sliding menu itself can be a fragement). Is this possible?

This is my current code: It displays the sliding menu only if requested by the user.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    //Slding menu
    slidingMenu = new SlidingMenu(this);
    slidingMenu.setMode(SlidingMenu.LEFT);
    slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    slidingMenu.setShadowWidthRes(R.dimen.slidingmenu_shadow_width);
    slidingMenu.setShadowDrawable(R.drawable.slidingmenu_shadow);
    slidingMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    slidingMenu.setFadeDegree(0.35f);
    slidingMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
    slidingMenu.setMenu(R.layout.slidingmenu);


    getActionBar().setDisplayHomeAsUpEnabled(true);

    getWindow().setWindowAnimations(0);
}

This is what I am trying to accomplish. Always show the menu on a tablet (on a phone, it should still be a sliding menu).

Tablet: on a tablet Phone: one a phone

Max
  • 12,622
  • 16
  • 73
  • 101
Mdlc
  • 7,128
  • 12
  • 55
  • 98
  • I dont think that library allows you to do that because when you clikc the moved content it closes the menu. you might want to look at SlidingPaneLayout because that is what is what is being used in this case http://developer.android.com/reference/android/support/v4/widget/SlidingPaneLayout.html if the view can fit on the screen it shows the content and the menu if it cant then you slide to see the menu – tyczj Dec 11 '13 at 15:42

1 Answers1

0

If you are using DrawerLayout you can use this method :

public void setDrawerLockMode (int lockMode, View drawerView)

Described here : http://developer.android.com/reference/android/support/v4/widget/DrawerLayout.html#setDrawerLockMode(int, android.view.View)

Maxime
  • 1,332
  • 1
  • 15
  • 43
  • My appologies, I was talking about JFeinsteins's sliding menu. Changed my question. – Mdlc Dec 11 '13 at 15:33