title: How to apply theme to preferencescreen
body: <p>I am creating PreferenceFragment in viewpager and getting error as</p>
  
  <pre><code>java.lang.IllegalStateException: Must specify preferenceTheme in theme
  </code></pre>
  
  <p>I referred <a href="https://stackoverflow.com/questions/32070670/preferencefragmentcompat-requires-preferencetheme-to-be-set">PreferenceFragmentCompat requires preferenceTheme to be set</a> but did not able to resolve. I added my styles.xml as below.</p>
  
  <pre><code>&lt;resources&gt;
  
      &lt;!-- Base application theme. --&gt;
      &lt;style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"&gt;
          &lt;!-- Customize your theme here. --&gt;
          &lt;item name="colorPrimary"&gt;@color/colorPrimary&lt;/item&gt;
          &lt;item name="colorPrimaryDark"&gt;@color/colorPrimaryDark&lt;/item&gt;
          &lt;item name="colorAccent"&gt;@color/colorAccent&lt;/item&gt;
          &lt;item name="android:preferenceStyle"&gt;@style/PreferenceThemeOverlay&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;style name="SettingsTheme" parent="Theme.AppCompat.Light.DarkActionBar"&gt;
          &lt;item name="preferenceTheme"&gt;@style/PreferenceThemeOverlay&lt;/item&gt;
      &lt;/style&gt;
  &lt;/resources&gt;
  </code></pre>
  
  <p>and below is code for manifest</p>
  
  <pre><code>  &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:supportsRtl="true"
          android:theme="@style/AppTheme" &gt;
          &lt;activity android:name=".MainActivity"
              android:theme="@style/Theme.AppCompat.DayNight.NoActionBar"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  </code></pre>
  
  <p>Below is code for pref screen</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
      android:key="screen"&gt;
  
      &lt;SwitchPreference
          android:key="sc"
          android:summary="Hi"
          android:title="Hello" /&gt;
  
  &lt;/PreferenceScreen&gt;
  </code></pre>
  
  <p>Can u advice, I m using theme first time and getting confused over it. Still getting same error.</p>