Android: Sliding Menu Slide only content

Lalith Mohan picture Lalith Mohan · Jun 1, 2013 · Viewed 7.1k times · Source

I'm using Sliding Menu with ActionBarSherlock in my application. The actionbar and sliding menu works fine, but i want the sliding menu to slide only the content and not the actionbar like the latest version of youtube application.

Is this possible with slidingmenu? If yes, please tell how

Thanks in advance

Below is my code for actionbar and slidingmenu

    getSlidingMenu().setSlidingEnabled(true);
    getSlidingMenu().setShadowWidthRes(R.dimen.shadow_width);
    getSlidingMenu().setShadowDrawable(R.drawable.shadow);
    getSlidingMenu().setBehindOffsetRes(R.dimen.actionbar_home_width);
    getSlidingMenu().setBehindScrollScale(0.25f);
    getSlidingMenu().setFadeDegree(0.35f);
    getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);

    final ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);

Answer

Mehul Joisar picture Mehul Joisar · Jun 1, 2013

Solution:

        setSlidingActionBarEnabled(false);

Reference:

Have a look at example

your final code will look something like this after adding the suggested solution,

getSlidingMenu().setSlidingEnabled(true);
getSlidingMenu().setShadowWidthRes(R.dimen.shadow_width);
getSlidingMenu().setShadowDrawable(R.drawable.shadow);
getSlidingMenu().setBehindOffsetRes(R.dimen.actionbar_home_width);
getSlidingMenu().setBehindScrollScale(0.25f);
getSlidingMenu().setFadeDegree(0.35f);
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);

final ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);

        setSlidingActionBarEnabled(false);

I hope it will be helpful !!