Package 

Class RecyclerView.RecycledViewPool


  • 
    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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 Type
        max - Maximum number
      • getRecycledViewCount

         int getRecycledViewCount(int viewType)

        Returns the current number of Views held by the RecycledViewPool of the given view 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.