PreferenceViewHolder
open class PreferenceViewHolder : RecyclerView.ViewHolder
kotlin.Any | ||
↳ | androidx.recyclerview.widget.RecyclerView.ViewHolder | |
↳ | androidx.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
Public methods |
|
---|---|
open View! |
findViewById(@IdRes id: Int) Returns a cached reference to a subview managed by this object. |
open 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. |
open 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. |
open Unit |
setDividerAllowedAbove(allowed: 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. |
open Unit |
setDividerAllowedBelow(allowed: 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. |
Inherited functions |
|
---|---|
Inherited properties |
|
---|---|
Public methods
findViewById
open fun findViewById(@IdRes id: 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 View#findViewById(int)
and caches the result.
Parameters | |
---|---|
id |
Int: Resource ID of the view to find |
Return | |
---|---|
View!: The view, or null if no view with the requested ID is found |
isDividerAllowedAbove
open 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.
Return | |
---|---|
Boolean: true if dividers are allowed above this item |
isDividerAllowedBelow
open 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.
Return | |
---|---|
Boolean: true if dividers are allowed below this item |
setDividerAllowedAbove
open 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, Preference#onBindViewHolder(PreferenceViewHolder)
will set this to the same value as returned by Preference#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
open 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, Preference#onBindViewHolder(PreferenceViewHolder)
will set this to the same value as returned by Preference#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 |