title: How to create preference headers groups in Android PreferenceActivity?
body: <p>I am using preference headers to create settings activity using <code>PreferenceActivity</code>. I am trying to divide the headers into categories/groups, like this one (there are categories Wireless &amp; Networks, Device, Personal, ...):</p>
  
  <p><img src="https://developer.android.com/images/ui/settings/settings-headers-tablet.png" alt=""></p>
  
  <p>Anyway, even that Android Developers site is about this way of creating preference activity, I couldn't find any way how to create the same preferences activity like they have on the image. The only I managed to do is simple list of preference headers.</p>
  
  <p>The only thing I have found is <a href="http://xgouchet.fr/android/index.php?article4/master-on-off-preferences-with-ice-cream-sandwich" rel="noreferrer">this</a>, but that works kinda... strange. So that does not seem as an option.</p>
  
  <p><strong>So my question is: How to create <code>PreferenceActivity</code> using preference headers with possibility of dividing headers into categories and with possibility of using master on/off switches?</strong></p>
  
  <p>Some of my code:</p>
  
  <p><strong>preference_headers.xml</strong>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;preference-headers xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;header 
          android:fragment="cz.vse.myevents.activity.SettingsActivity$EventsFragment"
          android:title="@string/settings_events"
          android:icon="@android:drawable/ic_menu_agenda" /&gt;
      &lt;header 
          android:fragment="cz.vse.myevents.activity.SettingsActivity$OrganizationsFragment"
          android:title="@string/settings_subscribed_organizations"
          android:icon="@android:drawable/ic_menu_view"  /&gt;
  &lt;/preference-headers&gt;
  </code></pre>
  
  <p><strong>SettingsActivity</strong>:</p>
  
  <pre><code>@Override
  public void onBuildHeaders(List&lt;Header&gt; target) {
      super.onBuildHeaders(target);
      loadHeadersFromResource(R.xml.preference_headers, target);
  }
  </code></pre>
  
  <p>I am not posting fragments resources, think it's unnecessary.</p>