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: Phone:
If you are using DrawerLayout you can use this method :
Described here : http://developer.android.com/reference/android/support/v4/widget/DrawerLayout.html#setDrawerLockMode(int, android.view.View)