code: private void hiJackDecor(){
  
          // Hijack the decorview
          ViewGroup decorView = (ViewGroup)mActivity.getWindow().getDecorView();
          ViewGroup mainContent = (ViewGroup) decorView.findViewById(android.R.id.content);
          mMainContent = mainContent.getChildAt(0);
          mainContent.removeViewAt(0);
  
          // Inflate DrawerLayout
          mDrawerLayout = inflateDrawerLayout(mainContent);
  
          // Insert the old activity content into the drawer content frame
          mDrawerContentFrame.addView(mMainContent, new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
  
          // Add the drawer-injected layout back into the decor
          mainContent.addView(mDrawerLayout);
      }
docs: Hijack the activities decor/content view to inject the drawer layout and pane
  into the activity without having to define the DrawerLayout as the root element in
  an Activities layout to enable the drawer