简体   繁体   中英

Which attribute is used for SwitchPreference color?

I'd like to adjust the colors in my settings fragment switches with styles.

The on position colors are done with <item name="colorAccent">@color/light_main_3</item> . I managed to change the color of the bar in the back in the off position with <item name="android:colorForeground">@color/dark_text_secondary</item> .

The only thing I haven't manage to change is the circle in it's off position. Which attribute is used for that?

Change white circle (off position)

Try setting

<item name="android:colorSwitchThumbNormal">@color/dark_text_secondary</item>

in your activity Theme . It is working for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM