added in version 22.1.0
belongs to Maven artifact com.android.support:recyclerview-v7:28.0.0-alpha1

RecyclerView.Recycler

public final class RecyclerView.Recycler
extends Object

java.lang.Object
   ↳ android.support.v7.widget.RecyclerView.Recycler


A Recycler is responsible for managing scrapped or detached item views for reuse.

A "scrapped" view is a view that is still attached to its parent RecyclerView but that has been marked for removal or reuse.

Typical use of a Recycler by a RecyclerView.LayoutManager will be to obtain views for an adapter's data set representing the data at a given position or item ID. If the view to be reused is considered "dirty" the adapter will be asked to rebind it. If not, the view can be quickly reused by the LayoutManager with no further work. Clean views that have not requested layout may be repositioned by a LayoutManager without remeasurement.

Summary

Public constructors

RecyclerView.Recycler()

Public methods

void bindViewToPosition(View view, int position)

Binds the given View to the position.

void clear()

Clear scrap views out of this recycler.

int convertPreLayoutPositionToPostLayout(int position)

RecyclerView provides artificial position range (item count) in pre-layout state and automatically maps these positions to RecyclerView.Adapter positions when getViewForPosition(int) or bindViewToPosition(View, int) is called.

List<RecyclerView.ViewHolder> getScrapList()

Returns an unmodifiable list of ViewHolders that are currently in the scrap list.

View getViewForPosition(int position)

Obtain a view initialized for the given position.

void recycleView(View view)

Recycle a detached view.

void setViewCacheSize(int viewCount)

Set the maximum number of detached, valid views we should retain for later use.

Inherited methods

From class java.lang.Object

Public constructors

RecyclerView.Recycler

added in version 22.1.0
RecyclerView.Recycler ()

Public methods

bindViewToPosition

added in version 22.1.0
void bindViewToPosition (View view, 
                int position)

Binds the given View to the position. The View can be a View previously retrieved via getViewForPosition(int) or created by onCreateViewHolder(ViewGroup, int).

Generally, a LayoutManager should acquire its views via getViewForPosition(int) and let the RecyclerView handle caching. This is a helper method for LayoutManager who wants to handle its own recycling logic.

Note that, getViewForPosition(int) already binds the View to the position so you don't need to call this method unless you want to bind this View to another position.

Parameters
view View: The view to update.

position int: The position of the item to bind to this View.

clear

added in version 22.1.0