-
public class RecyclerView.SmoothScroller.Action
Holds information about a smooth scroll request by a SmoothScroller.
-
-
Field Summary
Fields Modifier and Type Field Description public final static int
UNDEFINED_DURATION
-
Constructor Summary
Constructors Constructor Description RecyclerView.SmoothScroller.Action(int dx, int dy)
RecyclerView.SmoothScroller.Action(int dx, int dy, int duration)
RecyclerView.SmoothScroller.Action(int dx, int dy, int duration, Interpolator interpolator)
-
Method Summary
Modifier and Type Method Description void
jumpTo(int targetPosition)
Instead of specifying pixels to scroll, use the target position to jump using scrollToPosition. int
getDx()
void
setDx(@Px() int dx)
int
getDy()
void
setDy(@Px() int dy)
int
getDuration()
void
setDuration(int duration)
Interpolator
getInterpolator()
void
setInterpolator(@Nullable() Interpolator interpolator)
Sets the interpolator to calculate scroll steps void
update(@Px() int dx, @Px() int dy, int duration, @Nullable() Interpolator interpolator)
Updates the action with given parameters. -
-
Constructor Detail
-
RecyclerView.SmoothScroller.Action
RecyclerView.SmoothScroller.Action(int dx, int dy)
- Parameters:
dx
- Pixels to scroll horizontallydy
- Pixels to scroll vertically
-
RecyclerView.SmoothScroller.Action
RecyclerView.SmoothScroller.Action(int dx, int dy, int duration)
- Parameters:
dx
- Pixels to scroll horizontallydy
- Pixels to scroll verticallyduration
- Duration of the animation in milliseconds
-
RecyclerView.SmoothScroller.Action
RecyclerView.SmoothScroller.Action(int dx, int dy, int duration, Interpolator interpolator)
- Parameters:
dx
- Pixels to scroll horizontallydy
- Pixels to scroll verticallyduration
- Duration of the animation in millisecondsinterpolator
- Interpolator to be used when calculating scroll position in eachanimation step
-
-
Method Detail
-
jumpTo
void jumpTo(int targetPosition)
Instead of specifying pixels to scroll, use the target position to jump using scrollToPosition.
You may prefer using this method if scroll target is really far away and you preferto jump to a location and smooth scroll afterwards.
Note that calling this method takes priority over other update methods such as update, setX, setY and #setInterpolator. If you call jumpTo, the other changes will not be considered for this animationframe.
- Parameters:
targetPosition
- The target item position to scroll to using instant scrolling.
-
getDuration
int getDuration()
-
setDuration
void setDuration(int duration)
-
getInterpolator
@Nullable() Interpolator getInterpolator()
-
setInterpolator
void setInterpolator(@Nullable() Interpolator interpolator)
Sets the interpolator to calculate scroll steps
- Parameters:
interpolator
- The interpolator to use.
-
update
void update(@Px() int dx, @Px() int dy, int duration, @Nullable() Interpolator interpolator)
Updates the action with given parameters.
- Parameters:
dx
- Pixels to scroll horizontallydy
- Pixels to scroll verticallyduration
- Duration of the animation in millisecondsinterpolator
- Interpolator to be used when calculating scroll position in eachanimation step
-
-
-
-