3

Today I had one of those "android" moments again, which left me absolutely clueless.

I have an app which consists of a DrawerLayout, which includes a RelativeLayout as container for a SurfaceView (surfaceViewContainer) and a second ViewGroup (subclass of RelativeLayout) as navigation.

When the app starts, in onCreate I inflate the layout and add a SurfaceView to the surfaceViewContainer.

On a Samsung S2 with 4.1.2 and a S3 with 4.3 everything works fine, I can see the SurfaceView drawn and I can open and close the drawer, by swipe gesture or home button. Then I tested on Android 4.4 with a Nexus 5 and a Nexus 10, on both devices the drawer will not appear. Even pushing the home button won't do a thing.

Even stranger : I can open the Drawer before adding the SurfaceView, when I do so I can interact with the Drawer even after adding the SurfaceView, even on Android 4.4, so open/close works then.

So my question : Anybody experienced something like this before or has some advice or knows what might have changed from Android 4.3 to 4.4?!

ps: I used DrawerLayout successfully in other apps already, just not with SurfaceView, so I assume the problem lies there.

Thanks

ElDuderino
  • 3,253
  • 2
  • 21
  • 38

1 Answers1

9

Have you tried using implementing onDrawerSlide on the drawerListener of the drawerLayour like this

@Override
    public void onDrawerSlide(View drawerView, float slideOffset)
    {
        super.onDrawerSlide(drawerView, slideOffset);
        mDrawerLayout.bringChildToFront(drawerView);
        mDrawerLayout.requestLayout();
    }
pt123
  • 2,146
  • 1
  • 32
  • 57
  • It worked! I have a full screen SurfaceView rendering and the drawer would not animate while sliding in, but this solved it. Thanks! – Erik Živković Dec 02 '14 at 08:27
  • `super.onDrawerSlide` can not resolved..other things worked for me. – Ketan Ahir Mar 03 '15 at 05:39
  • Thanks a lot dude. You did it for me. I was struggling with this issue for last two days. overriding onDrawSlider method nailed it. – N-JOY Aug 20 '15 at 11:36