title: Appbar covers my settings fragment
body: <p>I'm trying to develop an Android application and I have a problem. I have one Navigation Drawer Activity, and when I click on an item from the Drawer it dynamically adds the fragment to the given activity from java code. This works perfectly with my news Fragment but when I want to add my Settings fragment (which is a PreferenceFragment) there is a slight problem: the appbar covers the top part (content) of my PreferenceFragment. How can I make my PreferenceFragment to stay (appear) below the appbar? Thanks in advance!</p>
  
  <p>This is my activity_main.xml file.</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"
  xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout"
  android:layout_width="match_parent" android:layout_height="match_parent"
  android:fitsSystemWindows="true" tools:openDrawer="start"&gt;
  
  &lt;include layout="@layout/app_bar_main" android:layout_width="match_parent"
      android:layout_height="match_parent" /&gt;
  
  &lt;android.support.design.widget.NavigationView android:id="@+id/nav_view"
      android:layout_width="wrap_content" android:layout_height="match_parent"
      android:layout_gravity="start" android:fitsSystemWindows="true"
      app:headerLayout="@layout/nav_header_main" app:menu="@menu/activity_main_drawer" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>This is my app_bar_main.xml file.</p>
  
  <pre><code>&lt;android.support.design.widget.CoordinatorLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
  android:id="@+id/fragment_container"
  android:layout_height="match_parent" android:fitsSystemWindows="true"
  tools:context=".MainActivity"&gt;
  
  &lt;android.support.design.widget.AppBarLayout android:layout_height="wrap_content"
      android:layout_width="match_parent" android:theme="@style/AppTheme.AppBarOverlay"&gt;
  
      &lt;android.support.v7.widget.Toolbar android:id="@+id/toolbar"
          android:layout_width="match_parent" android:layout_height="?attr/actionBarSize"
          android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" /&gt;
  
  &lt;/android.support.design.widget.AppBarLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>This is how I add the Settings fragment to my activity:</p>
  
  <pre><code>fragmentTransaction.add(R.id.fragment_container, settingsFragment).commit();
  </code></pre>
  
  <p>My SettingsFragment looks like this:</p>
  
  <pre><code>public class SettingsFragment extends PreferenceFragment {
      private static final boolean ALWAYS_SIMPLE_PREFS = false;
  
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          // Load the preferences from an XML resource
          addPreferencesFromResource(R.xml.pref_notification);
  
          Preference aboutPref = (Preference) findPreference("aboutKey");
          aboutPref.setOnPreferenceClickListener(new     Preference.OnPreferenceClickListener() {
              // some event handling code
          });
  
          Preference notiPref = (Preference) findPreference("notifications");
          notiPref.setOnPreferenceChangeListener(new    Preference.OnPreferenceChangeListener() {
             // some event handling code
          });
      }          
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          int id = item.getItemId();
          if (id == android.R.id.home) {
              return true;
          }
         return super.onOptionsItemSelected(item);
      }
  
      private static boolean isXLargeTablet(Context context) {
          return (context.getResources().getConfiguration().screenLayout
              &amp; Configuration.SCREENLAYOUT_SIZE_MASK) &gt;=  Configuration.SCREENLAYOUT_SIZE_XLARGE;
      }
  
      private static boolean isSimplePreferences(Context context) {
          return ALWAYS_SIMPLE_PREFS
              || Build.VERSION.SDK_INT &lt; Build.VERSION_CODES.HONEYCOMB
              || !isXLargeTablet(context);
      }
  }
  </code></pre>