RecyclerView.SmoothScroller.ScrollVectorProvider


public interface RecyclerView.SmoothScroller.ScrollVectorProvider

Known direct subclasses
LinearLayoutManager

A RecyclerView.LayoutManager implementation which provides similar functionality to android.widget.ListView.

StaggeredGridLayoutManager

A LayoutManager that lays out children in a staggered grid formation.

Known indirect subclasses
GridLayoutManager

A RecyclerView.LayoutManager implementations that lays out items in a grid.

WearableLinearLayoutManager

This wear-specific implementation of LinearLayoutManager provides basic offsetting logic for updating child layout.


An interface which is optionally implemented by custom RecyclerView.LayoutManager to provide a hint to a SmoothScroller about the location of the target position.

Summary

Public methods

abstract @Nullable PointF
computeScrollVectorForPosition(int targetPosition)

Should calculate the vector that points to the direction where the target position can be found.

Public methods

computeScrollVectorForPosition

Added in 1.0.0
abstract @Nullable PointF computeScrollVectorForPosition(int targetPosition)

Should calculate the vector that points to the direction where the target position can be found.

This method is used by the LinearSmoothScroller to initiate a scroll towards the target position.

The magnitude of the vector is not important. It is always normalized before being used by the LinearSmoothScroller.

LayoutManager should not check whether the position exists in the adapter or not.

Parameters
int targetPosition

the target position to which the returned vector should point

Returns
@Nullable PointF

the scroll vector for a given position.