Skip to content

CrazyBoyFeng/AndroidXPreferenceExtensions

Repository files navigation

AndroidX Preference Extensions

Android library: Extensions of AndroidX Preference.

Usage

  1. Add dependency through JitPack.
  2. XML
<PreferenceScreen>
    ...
    <EditTextPreferencePlus
        android:hint="hint"
        android:inputType="number"
        android:maxLength="4"
        app:formatSummary="true"
        app:key="edittext"
        app:summary="text is %s!"
        app:title="edittext" />
    ...
    <NumberPickerPreference
        app:formatSummary="true"
        app:key="numberpicker"
        app:maxValue="20"
        app:minValue="10"
        app:summary="%s sheep"
        app:title="numberpicker"
        app:wrapSelectorWheel="true" />
    ...
</PreferenceScreen>
  1. Fragment
import crazyboyfeng.android.preference.PreferenceFragmentCompat;
class MyPreferenceFragment extends PreferenceFragmentCompat {}