Google은 흑인 공동체를 위한 인종 간 평등을 진전시키기 위해 노력하고 있습니다. Google에서 어떤 노력을 하고 있는지 확인하세요.

ScrollVectorProvider

interface ScrollVectorProvider
androidx.recyclerview.widget.RecyclerView.SmoothScroller.ScrollVectorProvider

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 PointF?

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

Public methods

computeScrollVectorForPosition

@Nullable abstract fun computeScrollVectorForPosition(targetPosition: Int): PointF?

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
targetPosition Int: the target position to which the returned vector should point
Return
PointF? the scroll vector for a given position.