Recycler

inner class Recycler(source)

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 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.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
open fun bindViewToPosition(@NonNull view: View, position: Int)
Binds the given View to the position.
Link copied to clipboard
open fun clear()
Clear scrap views out of this recycler.
Link copied to clipboard
RecyclerView provides artificial position range (item count) in pre-layout state and automatically maps these positions to Adapter positions when getViewForPosition or bindViewToPosition is called.
Link copied to clipboard
Returns an unmodifiable list of ViewHolders that are currently in the scrap list.
Link copied to clipboard
open fun getViewForPosition(position: Int): View
Obtain a view initialized for the given position.
Link copied to clipboard
open fun recycleView(@NonNull view: View)
Recycle a detached view.
Link copied to clipboard
open fun setViewCacheSize(viewCount: Int)
Set the maximum number of detached, valid views we should retain for later use.