added in version 24.1.0
belongs to Maven artifact com.android.support:preference-v7:28.0.0-alpha1

Preference

public class Preference
extends Object implements Comparable<Preference>

java.lang.Object
   ↳ android.support.v7.preference.Preference
Known Direct Subclasses
Known Indirect Subclasses


Represents the basic Preference UI building block displayed by a PreferenceFragmentCompat in the form of a RecyclerView. This class provides data for the View to be displayed in the list and associates with a SharedPreferences to store/retrieve the preference data.

When specifying a preference hierarchy in XML, each element can point to a subclass of Preference, similar to the view hierarchy and layouts.

This class contains a key that will be used as the key into the SharedPreferences. It is up to the subclass to decide how to store the value.

Developer Guides

For information about building a settings UI with Preferences, read the Settings guide.

Summary

Nested classes

class Preference.BaseSavedState

A base class for managing the instance state of a Preference

interface Preference.OnPreferenceChangeListener

Interface definition for a callback to be invoked when the value of this Preference has been changed by the user and is about to be set and/or persisted. 

interface Preference.OnPreferenceClickListener

Interface definition for a callback to be invoked when a Preference is clicked. 

XML attributes

Preference_android_iconSpaceReserved  
Preference_android_singleLineTitle  

Constants