PreferenceViewHolder
public class PreferenceViewHolder extends RecyclerView.ViewHolder
| java.lang.Object | ||
| ↳ | 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.
Summary
Public methods |
|
|---|---|
View |
findViewById(@IdRes int id)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. |
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 |
||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public methods
findViewById
public View findViewById(@IdRes 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 and caches the result.
| Parameters | |
|---|---|
@IdRes int id |
Resource ID of the view to find |
| Returns | |
|---|---|
View |
The view, or |
isDividerAllowedAbove
public 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 |
|
isDividerAllowedBelow
public 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 |
|
setDividerAllowedAbove
public 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 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 | |
|---|---|
boolean allowed |
False to prevent dividers being drawn above this item |
setDividerAllowedBelow
public 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 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 | |
|---|---|
boolean allowed |
False to prevent dividers being drawn below this item |