ViewHolder

abstract class ViewHolder(source)

A ViewHolder describes an item view and metadata about its place within the RecyclerView.

Adapter implementations should subclass ViewHolder and add fields for caching potentially expensive findViewById results.

While LayoutParams belong to the LayoutManager, ViewHolders belong to the adapter. Adapters should feel free to use their own custom ViewHolder implementations to store data that makes binding view contents easier. Implementations should assume that individual item views will hold strong references to ViewHolder objects and that RecyclerView instances may hold strong references to extra off-screen item views for caching purposes

Constructors

Link copied to clipboard
constructor(@NonNull itemView: View)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
Returns the Adapter position of the item represented by this ViewHolder with respect to the RecyclerView's Adapter.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Returns the Adapter position of the item represented by this ViewHolder with respect to the Adapter that bound it.
Link copied to clipboard
Returns The itemId represented by this ViewHolder.
Link copied to clipboard
Link copied to clipboard
Returns the position of the ViewHolder in terms of the latest layout pass.
Link copied to clipboard
When LayoutManager supports animations, RecyclerView tracks 3 positions for ViewHolders to perform animations.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun setIsRecyclable(recyclable: Boolean)
Informs the recycler whether this item can be recycled.
Link copied to clipboard
open fun toString(): String