PreferenceViewHolder


class PreferenceViewHolder : RecyclerView.ViewHolder


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

Summary

Public functions

View!

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

Boolean

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

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.

Unit

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.

Unit

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 functions

From androidx.recyclerview.widget.RecyclerView.ViewHolder
Int

Returns the Adapter position of the item represented by this ViewHolder with respect to the RecyclerView's Adapter.

Int

This function is deprecated.

This method is confusing when adapters nest other adapters.

RecyclerView.Adapter<RecyclerView.ViewHolder!>?

Returns the Adapter that last bound this ViewHolder.

Int

Returns the Adapter position of the item represented by this ViewHolder with respect to the Adapter that bound it.

Long

Returns The itemId represented by this ViewHolder.

Int
Int

Returns the position of the ViewHolder in terms of the latest layout pass.

Int

When LayoutManager supports animations, RecyclerView tracks 3 positions for ViewHolders to perform animations.

Int

This function is deprecated.

This method is deprecated because its meaning is ambiguous due to the async handling of adapter updates.

Boolean
Unit
setIsRecyclable(recyclable: Boolean)

Informs the recycler whether this item can be recycled.

String!

Public functions

findViewById

Added in 1.0.0
fun findViewById(id: @IdRes Int): View!

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 and caches the result.

Parameters
id: @IdRes 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 1.0.0
fun isDividerAllowedAbove(): Boolean

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 1.0.0
fun isDividerAllowedBelow(): Boolean

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 1.0.0
fun setDividerAllowedAbove(allowed: Boolean): Unit

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 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 1.0.0
fun setDividerAllowedBelow(allowed: Boolean): Unit

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 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