-
public abstract class RecyclerView.ViewCacheExtension
ViewCacheExtension is a helper class to provide an additional layer of view caching that canbe controlled by the developer.
When getViewForPosition is called, Recycler checks attached scrap andfirst level cache to find a matching View. If it cannot find a suitable View, Recycler willcall the getViewForPositionAndType before checking RecycledViewPool.
Note that, Recycler never sends Views to this method to be cached. It is developersresponsibility to decide whether they want to keep their Views in this custom cache or letthe default recycling policy handle it.
-
-
Method Summary
Modifier and Type Method Description abstract View
getViewForPositionAndType(@NonNull() RecyclerView.Recycler recycler, int position, int type)
Returns a View that can be binded to the given Adapter position. -
-
Method Detail
-
getViewForPositionAndType
@Nullable() abstract View getViewForPositionAndType(@NonNull() RecyclerView.Recycler recycler, int position, int type)
Returns a View that can be binded to the given Adapter position.
This method should not create a new View. Instead, it is expected to returnan already created View that can be re-used for the given type and position.If the View is marked as ignored, it should first call stopIgnoringView before returning the View.
RecyclerView will re-bind the returned View to the position if necessary.
- Parameters:
recycler
- The Recycler that can be used to bind the Viewposition
- The adapter positiontype
- The type of the View, defined by adapter
-
-
-
-