-
public abstract class RecyclerView.SmoothScroller
Base class for smooth scrolling. Handles basic tracking of the target view position andprovides methods to trigger a programmatic scroll.
An instance of SmoothScroller is only intended to be used once. You should create a newinstance for each call to startSmoothScroll.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
RecyclerView.SmoothScroller.Action
Holds information about a smooth scroll request by a SmoothScroller.
public interface
RecyclerView.SmoothScroller.ScrollVectorProvider
An interface which is optionally implemented by custom LayoutManager to provide a hint to a SmoothScroller about the location of the target position.
-
Constructor Summary
Constructors Constructor Description RecyclerView.SmoothScroller()
-
Method Summary
Modifier and Type Method Description void
setTargetPosition(int targetPosition)
PointF
computeScrollVectorForPosition(int targetPosition)
Compute the scroll vector for a given target position. RecyclerView.LayoutManager
getLayoutManager()
boolean
isPendingInitialRun()
Returns true if SmoothScroller has been started but has not received the firstanimationcallback yet. boolean
isRunning()
int
getTargetPosition()
Returns the adapter position of the target item int
getChildPosition(View view)
int
getChildCount()
View
findViewByPosition(int position)
void
instantScrollToPosition(int position)
-
-
Method Detail
-
setTargetPosition
void setTargetPosition(int targetPosition)
-
computeScrollVectorForPosition
@Nullable() PointF computeScrollVectorForPosition(int targetPosition)
Compute the scroll vector for a given target position.
This method can return null if the layout manager cannot calculate a scroll vectorfor the given position (e.g. it has no current scroll position).
- Parameters:
targetPosition
- the position to which the scroller is scrolling
-
getLayoutManager
@Nullable() RecyclerView.LayoutManager getLayoutManager()
-
isPendingInitialRun
boolean isPendingInitialRun()
Returns true if SmoothScroller has been started but has not received the firstanimationcallback yet.
-
isRunning
boolean isRunning()
-
getTargetPosition
int getTargetPosition()
Returns the adapter position of the target item
-
getChildPosition
int getChildPosition(View view)
-
getChildCount
int getChildCount()
-
findViewByPosition
View findViewByPosition(int position)
-
instantScrollToPosition
@Deprecated() void instantScrollToPosition(int position)
-
-
-
-