RecyclerView.ViewHolder

public static abstract class RecyclerView.ViewHolder
extends Object

java.lang.Object
   ↳ androidx.recyclerview.widget.RecyclerView.ViewHolder


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

RecyclerView.Adapter implementations should subclass ViewHolder and add fields for caching potentially expensive View.findViewById(int) results.

While RecyclerView.LayoutParams belong to the RecyclerView.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

Summary

Fields

public final View itemView

Public constructors

ViewHolder(View itemView)

Public methods

final int getAbsoluteAdapterPosition()

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

final int