SimonVT / android-menudrawer

*DEPRECATED* A slide-out menu implementation, which allows users to navigate between views in your app.
http://simonvt.github.com/android-menudrawer/
Apache License 2.0
2.59k stars 1.11k forks source link

How to remove MenuDrawer from my rootView #271

Open AskMeCode opened 6 years ago

AskMeCode commented 6 years ago

Hello all,

How i can remove the MenuDrawer From my rootView ?? i use like this.

ViewGroup rootView = (ViewGroup) ((ViewGroup) this.activity.findViewById(android.R.id.content)).getChildAt(0);

menuDraw.setContentView(rootView);

????? Why this method not clear the previous menu: ????

private static void attachToDecor(Activity activity, MenuDrawer menuDrawer) {
    ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
    ViewGroup decorChild = (ViewGroup) decorView.getChildAt(0);

    decorView.removeAllViews();
    decorView.addView(menuDrawer, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

    menuDrawer.mContentContainer.addView(decorChild, decorChild.getLayoutParams());
}

best regard