LinearSmoothScroller
open class LinearSmoothScroller : RecyclerView.SmoothScroller
kotlin.Any | ||
↳ | androidx.recyclerview.widget.RecyclerView.SmoothScroller | |
↳ | androidx.recyclerview.widget.LinearSmoothScroller |
RecyclerView.SmoothScroller
implementation which uses a LinearInterpolator
until the target position becomes a child of the RecyclerView and then uses a DecelerateInterpolator
to slowly approach to target position.
If the RecyclerView.LayoutManager
you are using does not implement the RecyclerView.SmoothScroller.ScrollVectorProvider
interface, then you must override the computeScrollVectorForPosition(int)
method. All the LayoutManagers bundled with the support library implement this interface.
Summary
Constants | |
---|---|
static Int |
Decides if the child should be snapped from start or end, depending on where it currently is in relation to its parent. |
static Int |
Align child view's right or bottom with parent view's right or bottom |
static Int |
Align child view's left or top with parent view's left or top |
Public constructors | |
---|---|
Public methods | |
---|---|
open Int |
Helper method for |
open Int |
calculateDxToMakeVisible(view: View!, snapPreference: Int) Calculates the horizontal scroll amount necessary to make the given view fully visible inside the RecyclerView. |
open Int |
calculateDyToMakeVisible(view: View!, snapPreference: Int) Calculates the vertical scroll amount necessary to make the given view fully visible inside the RecyclerView. |
Protected methods | |
---|---|
open Float |
calculateSpeedPerPixel(displayMetrics: DisplayMetrics!) Calculates the scroll speed. |
open Int |
Calculates the time for deceleration so that transition from LinearInterpolator to DecelerateInterpolator looks smooth. |
open Int |
Calculates the time it should take to scroll the given distance (in pixels) |
open Int |
When scrolling towards a child view, this method defines whether we should align the left or the right edge of the child with the parent RecyclerView. |
open Int |
When scrolling towards a child view, this method defines whether we should align the top or the bottom edge of the child with the parent RecyclerView. |
open Unit |
onSeekTargetStep(dx: Int, dy: Int, state: RecyclerView.State, action: RecyclerView.SmoothScroller.Action) RecyclerView will call this method each time it scrolls until it can find the target position in the layout. |
open Unit |
onStart() Called when smooth scroll is started. |
open Unit |
onStop() Called when smooth scroller is stopped. |
open Unit |
onTargetFound(targetView: View, state: RecyclerView.State, action: RecyclerView.SmoothScroller.Action) Called when the target position is laid out. |
open Unit |
When the target scroll position is not a child of the RecyclerView, this method calculates a direction vector towards that child and triggers a smooth scroll. |
Inherited functions | |
---|---|