title: Android - How to reuse a wrapper layout for different layout XMLs?
body: <p>I want to make every activity have a same wrapper layout like a drawer or a bottom toolbar. It's easy to create a <code>BaseActivity</code> to reuse the code for all activities. But how can I reuse the XML wrapper for all the different activity layouts <strong>instead of adding different contents into a same XML file dynamically</strong>?</p>
  
  <p>For example, I have 5 XML layout files. They should have a same wrapper, and after I modify one of them, the others should be changed synchronously. A most simple example could be a drawer:</p>
  
  <pre><code>&lt;android.support.v4.widget.DrawerLayout 
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:id="@+id/drawer_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      // different content here
  
      &lt;android.support.design.widget.NavigationView
          android:id="@+id/navigation_view"
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:layout_gravity="start"
          app:headerLayout="@layout/drawer_header"
          app:menu="@menu/drawer" /&gt;
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>