java - PreferenceCategory theme not applied to PreferenceScreen -
i saw lots of answers , threads regarding problem alone tutorials how create custom preferencecategory. nothing works me. theme not applied.
preferenceactivity class:
public class preferencesactivity extends preferenceactivity{  private mypreferencefragment preferences;  @override    public void oncreate(bundle savedinstancestate) {        super.oncreate(savedinstancestate);     preferences = new mypreferencefragment();     getfragmentmanager().begintransaction().replace(android.r.id.content, preferences).commit(); }  public static class mypreferencefragment extends preferencefragment {     @override     public void oncreate(final bundle savedinstancestate)     {         super.oncreate(savedinstancestate);         addpreferencesfromresource(r.layout.mypreferences);                 }       }    } androidmanifest:
<activity android:name="com.gpsy.preferences.preferencesactivity"             android:screenorientation="portrait" android:configchanges="keyboardhidden|orientation"                          android:theme="@style/custom"> </activity> styles.xml:
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="preferencelistheader" >     <item name="android:textcolor">#000000</item>     <item name="android:textstyle">bold</item>     <item name="android:textsize">12sp</item>     <item name="android:background">@color/gray</item>     <item name="android:paddingtop">6dp</item>     <item name="android:paddingbottom">6dp</item>     <item name="android:paddingleft">12dp</item> </style>  <style name="custom" parent="@android:theme.light.notitlebar">     <item name="android:listseparatortextviewstyle">@style/preferencelistheader</item>                </style> </resources> mypreferences.xml:
<?xml version="1.0" encoding="utf-8"?> <preferencescreen xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" >  <preferencecategory         android:title="@string/gps_settings">      <listpreference             android:key="nav_systems_preference"             android:title="@string/my_nav_app"             android:summary="summary_checkbox_preference"/>  </preferencecategory> </preferencescreen> also, tried apply theme following way without success:
settheme(r.style.custom); tryed change preferencecategory tag
<preferencecategory android:widgetlayout="@style/custom"         android:title="@string/gps_settings"> 
your theme not working because did not set android:layout_width , android:layout_weight nor inherited parent (which not given).
for <style name="preferencelistheader" >, add following:
<item name="android:layout_width">fill_parent</item> <item name="android:layout_height">wrap_content</item> you don't need settheme(r.style.custom); or android:widgetlayout="@style/custom" then. can't provide style android:widgetlayout, anyway. have provide layout resource contains textview. if choose use style (see above), don't need set layout.