-
public class RecyclerView.RecycledViewPool
RecycledViewPool lets you share Views between multiple RecyclerViews.
If you want to recycle views across RecyclerViews, create an instance of RecycledViewPooland use setRecycledViewPool.
RecyclerView automatically creates a pool for itself if you don't provide one.
-
-
Method Summary
Modifier and Type Method Description void
clear()
Discard all ViewHolders. void
setMaxRecycledViews(int viewType, int max)
Sets the maximum number of ViewHolders to hold in the pool before discarding. int
getRecycledViewCount(int viewType)
Returns the current number of Views held by the RecycledViewPool of the given view type. RecyclerView.ViewHolder
getRecycledView(int viewType)
Acquire a ViewHolder of the specified type from the pool, or {@code null}
if none arepresent.void
putRecycledView(RecyclerView.ViewHolder scrap)
Add a scrap ViewHolder to the pool. -
-
Method Detail
-
clear
void clear()
Discard all ViewHolders.
-
setMaxRecycledViews
void setMaxRecycledViews(int viewType, int max)
Sets the maximum number of ViewHolders to hold in the pool before discarding.
- Parameters:
viewType
- ViewHolder Typemax
- Maximum number
-
getRecycledViewCount
int getRecycledViewCount(int viewType)
Returns the current number of Views held by the RecycledViewPool of the given view type.
-
getRecycledView
@Nullable() RecyclerView.ViewHolder getRecycledView(int viewType)
Acquire a ViewHolder of the specified type from the pool, or
{@code null}
if none arepresent.- Parameters:
viewType
- ViewHolder type.
-
putRecycledView
void putRecycledView(RecyclerView.ViewHolder scrap)
Add a scrap ViewHolder to the pool.
If the pool is already full for that ViewHolder's type, it will be immediately discarded.
- Parameters:
scrap
- ViewHolder to be added to the pool.
-
-
-
-