Replica of official Settings page for M3, for use with Preferences library
- Gradle:
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.TTTT55:Material-You-Preferences:$latest_version'
}
- XML preferences:
Add the desired preferences ( MaterialPreference
, MaterialSwitchPreference
, MaterialSwitchGooglePreference
, MaterialHeaderSwitchPreference
, MaterialListPreference
, MaterialEditTextPreference
, MaterialColorPreference
, MaterialSeekBarPreference
)
to your preference XML:
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory>
<com.github.tttt55.materialyoupreferences.preferences.MaterialPreference
android:key="preference_one"
app:icon="@drawable/ic_pref_icon"
android:summary="@string/preference_summary"
android:title="@string/preference_title"/>
...
</PreferenceCategory>
</PreferenceScreen>
To remove dividers between preferences in XML, use the following attributes:
app:allowDividerAbove="false"
or app:allowDividerBelow="false"
MaterialSwitchPreference is the switch you commonly see in AOSP android 12-14, while MaterialSwitchGooglePreference is the "preferenced" version of Google's MaterialSwitch as seen in android 15 developer preview.