The standard PreferenceCategory widget shows only the title; The android:summary attribute is ignored.
This is because the default layout ( preference_category.xml ) contains only one TextView for the header field:
<TextView xmlns:android="http://schemas.android.com/apk/res/android" style="?android:attr/listSeparatorTextViewStyle" android:id="@+android:id/title" />
If you want to also show a summary, you can specify your own layout using the android:layout attribute. For instance:
<PreferenceCategory android:title="Category" android:summary="This is the summary" android:layout="@layout/preference_category_summary">
Where layout / preference_category_summary.xml is something like:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:id="@+android:id/title" style="?android:attr/listSeparatorTextViewStyle"/> <TextView android:id="@+android:id/summary" android:paddingLeft="5dip" android:paddingRight="dip" android:layout_width="match_parent" android:layout_height="wrap_content"/> </LinearLayout>
Before you go further and do this, you should think about how less or less confusing for the user. If you do not accurately draw the final text, it either jumps out of the screen, or seems to join the first preference in the category.
source share