added in version 24.1.0
belongs to Maven artifact


public abstract class PreferenceGroup
extends Preference

Known Direct Subclasses

A container for multiple Preference objects. It is a base class for Preference objects that are parents, such as PreferenceCategory and PreferenceScreen.

Developer Guides

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


Nested classes

interface PreferenceGroup.PreferencePositionCallback

Interface for PreferenceGroup Adapters to implement so that scrollToPreference(String) and scrollToPreference(Preference) or scrollToPreference(String) and scrollToPreference(Preference) can determine the correct scroll position to request. 

XML attributes


Inherited XML attributes

From class

Inherited constants

From class

Public constructors

PreferenceGroup(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
PreferenceGroup(Context context, AttributeSet attrs, int defStyleAttr)
PreferenceGroup(Context context, AttributeSet attrs)

Public methods

void addItemFromInflater(Preference preference)

Called by the inflater to add an item to this group.

boolean addPreference(Preference preference)

Adds a Preference at the correct position based on the preference's order.

Preference findPreference(CharSequence key)

Finds a Preference based on its key.

int getInitialExpandedChildrenCount()

Gets the maximal number of children that is initially shown.

Preference getPreference(int index)

Returns the Preference at a particular index.