Reputation: 4256
The Androidx Preference library offers, amongst others, two classes for implementing a SwitchPreference in Settings screens:
Both implementations in the AOSP source code at the time of writting this question (AOSP Androidx SwitchPreference and AOSP Androidx SwitchPreferenceCompat) looks mostly the same except for some syleables, etc...
So my question is which one do we have to use, considering compatibility with possible future changes of their implementation
Upvotes: 6
Views: 2206
Reputation: 41
The Switch
widget is the only difference between them.
In API 21 and above, they are the same, because the system will automatically override the classic widgets with the material style.
See also: Switch vs. SwitchCompat
Upvotes: 1