Angelica
Angelica

Reputation: 478

change PreferenceCategory summary field color

How to change the PreferenceCategory summary field color

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   xmlns:tools="http://schemas.android.com/tools">

  <PreferenceCategory
    android:paddingStart="0dp"
    app:allowDividerAbove="false"
    app:summary="Hello"
    app:title="@string/sync_header">

    <SwitchPreferenceCompat
        app:key="sync"
        app:title="@string/sync_title" />

    <SwitchPreferenceCompat

        app:dependency="sync"
        app:key="attachment"
        app:summaryOff="@string/attachment_summary_off"       <---------------
        app:summaryOn="@string/attachment_summary_on"         <---------------

        app:title="@string/attachment_title" />

    </PreferenceCategory>
</PreferenceScreen>

my default text-secondary color is white for the entire application, and application background is defaults to white

<item name="android:textColorSecondary">@android:color/white</item>

So the app:summaryOff="Will Sync on Midnight" is always white and becomes invisible.

Just want to change the summary color from white to gray.

<item name="android:textColorSecondary">@android:color/darker_gray</item>

solves the purpose of summary but creates another color problem because textColorSecondary must be white for the app.

Upvotes: 0

Views: 101

Answers (0)

Related Questions