Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crouton + SlidingMenu overlap

I'm using both SlidingMenu and Crouton, but I've found that the sliding menu overlaps the crouton notification

crouton and slidingmenu overlap

I would report an issue in github, but I don't know where the bug belongs.

Cyril Mottier mentions in his Prixing article about in-layout notifications the existence of 3 Contexts, the left menu having a Context on its own. That way, the Notification slides with the rest of the content.

enter image description here

Because both SlidingMenu and Crouton use the Activity Context, maybe this simply isn't fixable. We can easily call

Crouton.cancelAllCroutons();

before displaying the SlidingMenu, but I like Prixing's slide-out feature.

Hopefully the library authors can claim the bug or shed some light on it.

Thanks!

EDIT:

I'm using the SlidingMenu by creating the object and attaching it to the activity

private void configureSideMenu() {
   mSlidingMenu = new SlidingMenu(this);
   mSlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
   mSlidingMenu.setFadeDegree(0.35f);
   mSlidingMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
   mSlidingMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
   mSlidingMenu.setMenu(R.layout.menu_frame);
   getSupportFragmentManager().beginTransaction().replace(R.id.menu_frame, new MySideMenuFragment()).commit();
 }

And the Crouton, I guess there's only one way to use it

  Crouton.showText(this, R.string.error_not_logged_in, Style.ALERT);

Where this is the same Activity for both cases

like image 897
Maragues Avatar asked Mar 15 '13 13:03

Maragues


1 Answers

You can easily attach a Crouton to a specific ViewGroup.

All you need to do is call Crouton.makeText(Activity, CharSequence, Style, ViewGroup), Crouton.make(...) or Crouton.show(...).

The created Crouton then is attached to the ViewGroup and will slide out with it's parent when the SlidingMenu opens.

So, when you're creating the Crouton from a Fragment

Crouton.showText(this, R.string.error_not_logged_in, Style.ALERT, (ViewGroup) getView());

Else you can add it to any ViewGroup (even by resource id), although I recommend to have a FrameLayout to attach the Crouton to.

like image 107
keyboardsurfer Avatar answered Nov 02 '22 03:11

keyboardsurfer