I have a simple preference screen defined like this
Styling it as described in inazaruk's answer is simple enough but it only changes the style of the text in the heading, it doesn't offer a way to specify a whole new layout (the style will not apply the layout item). There is, however, a straightforward solution if you extend the class:
public class MyPreferenceCategory extends PreferenceCategory {
public MyPreferenceCategory(Context context) {
super(context);
setLayoutResource(R.layout.yourlayout);
}
public MyPreferenceCategory(Context context, AttributeSet attrs) {
super(context, attrs);
setLayoutResource(R.layout.yourlayout);
}
}
and simply use this instead of the original PreferenceCategory when defining your Preferences layout.
Your layout can, of course, have anything you like, including lines above or below the text, different backgrounds, padding, whatever. For instance, this will show a material design colored subtitle with a line above: