public static class RecyclerView.SmoothScroller.Action
extends Object
| java.lang.Object | |
| android.support.v7.widget.RecyclerView.SmoothScroller.Action | |
由 RecyclerView.SmoothScroller保存有关平滑滚动请求的 RecyclerView.SmoothScroller 。
常量(Constants) |
|
|---|---|
int |
UNDEFINED_DURATION |
Public constructors |
|
|---|---|
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) |
|
公共方法(Public methods) |
|
|---|---|
int |
getDuration() |
int |
getDx() |
int |
getDy() |
Interpolator |
getInterpolator() |
void |
jumpTo(int targetPosition) 而不是指定像素滚动,使用目标位置跳转使用 |
void |
setDuration(int duration) |
void |
setDx(int dx) |
void |
setDy(int dy) |
void |
setInterpolator(Interpolator interpolator) 设置插值器以计算滚动步骤 |
void |
update(int dx, int dy, int duration, Interpolator interpolator) 用给定的参数更新动作。 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
int UNDEFINED_DURATION
常量值:-2147483648(0x80000000)
RecyclerView.SmoothScroller.Action (int dx,
int dy)
| 参数(Parameters) | |
|---|---|
dx |
int: Pixels to scroll horizontally |
dy |
int: Pixels to scroll vertically |
RecyclerView.SmoothScroller.Action (int dx,
int dy,
int duration)
| 参数(Parameters) | |
|---|---|
dx |
int: Pixels to scroll horizontally |
dy |
int: Pixels to scroll vertically |
duration |
int: Duration of the animation in milliseconds |
RecyclerView.SmoothScroller.Action (int dx,
int dy,
int duration,
Interpolator interpolator)
| 参数(Parameters) | |
|---|---|
dx |
int: Pixels to scroll horizontally |
dy |
int: Pixels to scroll vertically |
duration |
int: Duration of the animation in milliseconds |
interpolator |
Interpolator: Interpolator to be used when calculating scroll position in each animation step |
int getDuration ()
| 返回(Returns) | |
|---|---|
int |
|
int getDx ()
| 返回(Returns) | |
|---|---|
int |
|
int getDy ()
| 返回(Returns) | |
|---|---|
int |
|
void jumpTo (int targetPosition)
而不是指定像素滚动,使用目标位置跳转使用 scrollToPosition(int) 。
如果滚动目标真的很远,并且您更愿意跳转到某个位置并在之后平滑滚动,则可能更喜欢使用此方法。
请注意,调用此方法比其他更新方法,例如优先update(int, int, int, Interpolator) , setX(float) , setY(float)和# setInterpolator(Interpolator) 。 如果您致电jumpTo(int) ,则其他更改将不被考虑用于此动画帧。
| 参数(Parameters) | |
|---|---|
targetPosition |
int: The target item position to scroll to using instant scrolling. |
void setDuration (int duration)
| 参数(Parameters) | |
|---|---|
duration |
int
|
void setDx (int dx)
| 参数(Parameters) | |
|---|---|
dx |
int
|
void setDy (int dy)
| 参数(Parameters) | |
|---|---|
dy |
int
|
void setInterpolator (Interpolator interpolator)
设置插值器以计算滚动步骤
| 参数(Parameters) | |
|---|---|
interpolator |
Interpolator: The interpolator to use. If you specify an interpolator, you must also set the duration. |
也可以看看:
void update (int dx,
int dy,
int duration,
Interpolator interpolator)
用给定的参数更新动作。
| 参数(Parameters) | |
|---|---|
dx |
int: Pixels to scroll horizontally |
dy |
int: Pixels to scroll vertically |
duration |
int: Duration of the animation in milliseconds |
interpolator |
Interpolator: Interpolator to be used when calculating scroll position in each animation step |