Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.
added in version 24.1.0
belongs to Maven artifact com.android.support:preference-v7:28.0.0-alpha1

PreferenceViewHolder

public class PreferenceViewHolder
extends RecyclerView.ViewHolder

java.lang.Object
   ↳ android.support.v7.widget.RecyclerView.ViewHolder
     ↳ android.support.v7.preference.PreferenceViewHolder


A RecyclerView.ViewHolder class which caches views associated with the default Preference layouts. Cached views can be retrieved by calling findViewById(int).

Summary

Inherited fields

From class android.support.v7.widget.RecyclerView.ViewHolder

Public methods

View findViewById(int id)

Returns a cached reference to a subview managed by this object.

boolean isDividerAllowedAbove()

Dividers are only drawn between items if both items allow it, or above the first and below the last item if that item allows it.

boolean isDividerAllowedBelow()

Dividers are only drawn between items if both items allow it, or above the first and below the last item if that item allows it.

void setDividerAllowedAbove(boolean allowed)

Dividers are only drawn between items if both items allow it, or above the first and below the last item if that item allows it.

void setDividerAllowedBelow(boolean allowed)

Dividers are only drawn between items if both items allow it, or above the first and below the last item if that item allows it.

Inherited methods

From class android.support.v7.widget.RecyclerView.ViewHolder
From class java.lang.Object

Public methods

findViewById

added in version 24.1.0
View findViewById (int id)

Returns a cached reference to a subview managed by this object. If the view reference is not yet cached, it falls back to calling findViewById(int) and caches the result.

Parameters
id int: Resource ID of the view to find

Returns
View The view, or null if no view with the requested ID is found.

isDividerAllowedAbove

added in version 24.1.0
boolean isDividerAllowedAbove ()

Dividers are only drawn between items if both items allow it, or above the first and below the last item if that item allows it.

Returns
boolean true if dividers are allowed above this item

isDividerAllowedBelow

added in version 24.1.0
boolean isDividerAllowedBelow ()

Dividers are only drawn between items if both items allow it, or above the first and below the last item if that item allows it.

Returns
boolean true if dividers are allowed below this item

setDividerAllowedAbove

added in version 24.1.0
void setDividerAllowedAbove (boolean allowed)

Dividers are only drawn between items if both items allow it, or above the first and below the last item if that item allows it. By default, onBindViewHolder(PreferenceViewHolder) will set this to the same value as returned by isSelectable(), so that non-selectable items do not have a divider drawn above them.

Parameters
allowed boolean: false to prevent dividers being drawn above this item

setDividerAllowedBelow

added in version 24.1.0
void setDividerAllowedBelow (boolean allowed)

Dividers are only drawn between items if both items allow it, or above the first and below the last item if that item allows it. By default, onBindViewHolder(PreferenceViewHolder) will set this to the same value as returned by isSelectable(), so that non-selectable items do not have a divider drawn below them.

Parameters
allowed boolean: false to prevent dividers being drawn below this item