Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

PreferenceCategory

public class PreferenceCategory
extends PreferenceGroup

java.lang.Object
   ↳ androidx.preference.Preference
     ↳ androidx.preference.PreferenceGroup
       ↳ androidx.preference.PreferenceCategory


A container that is used to group similar Preferences. A PreferenceCategory displays a category title and visually separates groups of Preferences.

Developer Guides

For information about building a settings screen using the AndroidX Preference library, see Settings.

Summary

Inherited constants

Public constructors

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

Public methods

boolean isEnabled()

Checks whether this preference should be enabled in the list.

void onBindViewHolder(PreferenceViewHolder holder)

Binds the created View to the data for this preference.

void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfoCompat info)

Initializes an AccessibilityNodeInfo with information about the View for this preference.

boolean shouldDisableDependents()

Checks whether this preference's dependents should currently be disabled.

Inherited methods

Public constructors

PreferenceCategory

public PreferenceCategory (Context context, 
                AttributeSet attrs, 
                int defStyleAttr, 
                int defStyleRes)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

defStyleRes int

PreferenceCategory

public PreferenceCategory (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

PreferenceCategory

public PreferenceCategory (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

PreferenceCategory

public PreferenceCategory (Context context)

Parameters
context Context

Public methods

isEnabled

public boolean isEnabled ()

Checks whether this preference should be enabled in the list.

Returns
boolean true if this preference is enabled, false otherwise

onBindViewHolder

public void onBindViewHolder (PreferenceViewHolder holder)

Binds the created View to the data for this preference.

This is a good place to grab references to custom Views in the layout and set properties on them.

Make sure to call through to the superclass's implementation.

Parameters
holder PreferenceViewHolder: The ViewHolder that provides references to the views to fill in. These views will be recycled, so you should not hold a reference to them after this method returns.

onInitializeAccessibilityNodeInfo

public void onInitializeAccessibilityNodeInfo (AccessibilityNodeInfoCompat info)

Initializes an AccessibilityNodeInfo with information about the View for this preference.

Parameters
info AccessibilityNodeInfoCompat

shouldDisableDependents

public boolean shouldDisableDependents ()

Checks whether this preference's dependents should currently be disabled.

Returns
boolean true if the dependents should be disabled, otherwise false