Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Sliding Menu Slide only content

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);
like image 519
Lalith Mohan Avatar asked Jun 01 '13 12:06

Lalith Mohan


2 Answers

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 !!

like image 120
Mehul Joisar Avatar answered Sep 30 '22 18:09

Mehul Joisar


According to the developer on GitHub:

SlidingMenu Integration

Look at step 1. You have 2 options, SlidingMenu.SLIDING_WINDOW or SlidingMenu.SLIDING_CONTENT.

SLIDING_WINDOW will include the Title/ActionBar in the content section of the SlidingMenu, while SLIDING_CONTENT does not.

like image 40
bassicplays Avatar answered Sep 30 '22 18:09

bassicplays