# Scroller

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Scroller

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/widget/Scroller "View this page in Java")  

```
open class Scroller
```

|---|----------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                     ||
| ↳ | [android.widget.Scroller](https://developer.android.com/reference/kotlin/android/widget/Scroller#) |

This class encapsulates scrolling. You can use scrollers ([Scroller](https://developer.android.com/reference/kotlin/android/widget/Scroller#)or[OverScroller](https://developer.android.com/reference/kotlin/android/widget/OverScroller)) to collect the data you need to produce a scrolling animation---for example, in response to a fling gesture. Scrollers track scroll offsets for you over time, but they don't automatically apply those positions to your view. It's your responsibility to get and apply new coordinates at a rate that will make the scrolling animation look smooth.

Here is a simple example:  

```kotlin
private Scroller mScroller = new Scroller(context);
  ...
  public void zoomIn() {
      // Revert any animation currently in progress
      mScroller.forceFinished(true);
      // Start scrolling by providing a starting point and
      // the distance to travel
      mScroller.startScroll(0, 0, 100, 0);
      // Invalidate to request a redraw
      invalidate();
  }
```

To track the changing positions of the x/y coordinates, use[computeScrollOffset](https://developer.android.com/reference/kotlin/android/widget/Scroller#computeScrollOffset()). The method returns a boolean to indicate whether the scroller is finished. If it isn't, it means that a fling or programmatic pan operation is still in progress. You can use this method to find the current offsets of the x and y coordinates, for example:  

```kotlin
if (mScroller.computeScrollOffset()) {
      // Get current x and y positions
      int currX = mScroller.getCurrX();
      int currY = mScroller.getCurrY();
     ...
  }
```

## Summary

|                                                                                                                                                                                                                                                                             Public constructors                                                                                                                                                                                                                                                                             ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Scroller](https://developer.android.com/reference/kotlin/android/widget/Scroller#Scroller(android.content.Context))`(`context:` `[Context](https://developer.android.com/reference/kotlin/android/content/Context.html#)!`)` Create a Scroller with the default duration and interpolator.                                                                                                                                                                                                                                                                              |
| [Scroller](https://developer.android.com/reference/kotlin/android/widget/Scroller#Scroller(android.content.Context,%20android.view.animation.Interpolator))`(`context:` `[Context](https://developer.android.com/reference/kotlin/android/content/Context.html#)!`, `interpolator:` `[Interpolator](https://developer.android.com/reference/kotlin/android/view/animation/Interpolator.html#)!`)` Create a Scroller with the specified interpolator.                                                                                                                     |
| [Scroller](https://developer.android.com/reference/kotlin/android/widget/Scroller#Scroller(android.content.Context,%20android.view.animation.Interpolator,%20kotlin.Boolean))`(`context:` `[Context](https://developer.android.com/reference/kotlin/android/content/Context.html#)!`, `interpolator:` `[Interpolator](https://developer.android.com/reference/kotlin/android/view/animation/Interpolator.html#)!`, `flywheel:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Create a Scroller with the specified interpolator. |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ||
|----------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)       | [abortAnimation](https://developer.android.com/reference/kotlin/android/widget/Scroller#abortAnimation())`()` Stops the animation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| open[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [computeScrollOffset](https://developer.android.com/reference/kotlin/android/widget/Scroller#computeScrollOffset())`()` Call this when you want to know the new location.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)       | [extendDuration](https://developer.android.com/reference/kotlin/android/widget/Scroller#extendDuration(kotlin.Int))`(`extend:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Extend the scroll animation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)       | [fling](https://developer.android.com/reference/kotlin/android/widget/Scroller#fling(kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int))`(`startX:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `startY:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `velocityX:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `velocityY:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `minX:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `maxX:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `minY:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `maxY:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Start scrolling based on a fling gesture. |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [forceFinished](https://developer.android.com/reference/kotlin/android/widget/Scroller#forceFinished(kotlin.Boolean))`(`finished:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Force the finished field to a particular value.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| open[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)     | [getCurrVelocity](https://developer.android.com/reference/kotlin/android/widget/Scroller#getCurrVelocity())`()` Returns the current velocity.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)             | [getCurrX](https://developer.android.com/reference/kotlin/android/widget/Scroller#getCurrX())`()` Returns the current X offset in the scroll.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)             | [getCurrY](https://developer.android.com/reference/kotlin/android/widget/Scroller#getCurrY())`()` Returns the current Y offset in the scroll.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)             | [getDuration](https://developer.android.com/reference/kotlin/android/widget/Scroller#getDuration())`()` Returns how long the scroll event will take, in milliseconds.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)             | [getFinalX](https://developer.android.com/reference/kotlin/android/widget/Scroller#getFinalX())`()` Returns where the scroll will end.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)             | [getFinalY](https://developer.android.com/reference/kotlin/android/widget/Scroller#getFinalY())`()` Returns where the scroll will end.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)             | [getStartX](https://developer.android.com/reference/kotlin/android/widget/Scroller#getStartX())`()` Returns the start X offset in the scroll.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)             | [getStartY](https://developer.android.com/reference/kotlin/android/widget/Scroller#getStartY())`()` Returns the start Y offset in the scroll.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)     | [isFinished](https://developer.android.com/reference/kotlin/android/widget/Scroller#isFinished())`()` Returns whether the scroller has finished scrolling.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)       | [setFinalX](https://developer.android.com/reference/kotlin/android/widget/Scroller#setFinalX(kotlin.Int))`(`newX:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the final position (X) for this scroller.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)       | [setFinalY](https://developer.android.com/reference/kotlin/android/widget/Scroller#setFinalY(kotlin.Int))`(`newY:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the final position (Y) for this scroller.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)           | [setFriction](https://developer.android.com/reference/kotlin/android/widget/Scroller#setFriction(kotlin.Float))`(`friction:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`)` The amount of friction applied to flings.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)       | [startScroll](https://developer.android.com/reference/kotlin/android/widget/Scroller#startScroll(kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int))`(`startX:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `startY:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `dx:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `dy:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Start scrolling by providing a starting point and the distance to travel.                                                                                                                                                                                                                                                                                                                                                                                   |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)       | [startScroll](https://developer.android.com/reference/kotlin/android/widget/Scroller#startScroll(kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int))`(`startX:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `startY:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `dx:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `dy:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `duration:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Start scrolling by providing a starting point, the distance to travel, and the duration of the scroll.                                                                                                                                                                                                                                              |
| open[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)         | [timePassed](https://developer.android.com/reference/kotlin/android/widget/Scroller#timePassed())`()` Returns the time elapsed since the beginning of the scrolling.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |

## Public constructors

### Scroller

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Scroller(context: Context!)
```

Create a Scroller with the default duration and interpolator.  

### Scroller

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Scroller(
    context: Context!, 
    interpolator: Interpolator!)
```

Create a Scroller with the specified interpolator. If the interpolator is null, the default (viscous) interpolator will be used. "Flywheel" behavior will be in effect for apps targeting Honeycomb or newer.  

### Scroller

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Scroller(
    context: Context!, 
    interpolator: Interpolator!, 
    flywheel: Boolean)
```

Create a Scroller with the specified interpolator. If the interpolator is null, the default (viscous) interpolator will be used. Specify whether or not to support progressive "flywheel" behavior in flinging.

## Public methods

### abortAnimation

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun abortAnimation(): Unit
```

Stops the animation. Contrary to[forceFinished(boolean)](https://developer.android.com/reference/kotlin/android/widget/Scroller#forceFinished(kotlin.Boolean)), aborting the animating cause the scroller to move to the final x and y position  
**See Also**

- [#forceFinished(boolean)](https://developer.android.com/reference/kotlin/android/widget/Scroller#forceFinished(kotlin.Boolean))  

### computeScrollOffset

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun computeScrollOffset(): Boolean
```

Call this when you want to know the new location. If it returns true, the animation is not yet finished.  

### extendDuration

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun extendDuration(extend: Int): Unit
```

Extend the scroll animation. This allows a running animation to scroll further and longer, when used with[setFinalX(int)](https://developer.android.com/reference/kotlin/android/widget/Scroller#setFinalX(kotlin.Int))or[setFinalY(int)](https://developer.android.com/reference/kotlin/android/widget/Scroller#setFinalY(kotlin.Int)).

|                                                           Parameters                                                            ||
|----------|-----------------------------------------------------------------------------------------------------------------------|
| `extend` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Additional time to scroll in milliseconds. |

**See Also**

- [#setFinalX(int)](https://developer.android.com/reference/kotlin/android/widget/Scroller#setFinalX(kotlin.Int))
- [#setFinalY(int)](https://developer.android.com/reference/kotlin/android/widget/Scroller#setFinalY(kotlin.Int))  

### fling

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun fling(
    startX: Int, 
    startY: Int, 
    velocityX: Int, 
    velocityY: Int, 
    minX: Int, 
    maxX: Int, 
    minY: Int, 
    maxY: Int
): Unit
```

Start scrolling based on a fling gesture. The distance travelled will depend on the initial velocity of the fling.

|                                                                        Parameters                                                                        ||
|-------------|---------------------------------------------------------------------------------------------------------------------------------------------|
| `startX`    | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Starting point of the scroll (X)                                 |
| `startY`    | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Starting point of the scroll (Y)                                 |
| `velocityX` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Initial velocity of the fling (X) measured in pixels per second. |
| `velocityY` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Initial velocity of the fling (Y) measured in pixels per second  |
| `minX`      | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Minimum X value. The scroller will not scroll past this point.   |
| `maxX`      | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Maximum X value. The scroller will not scroll past this point.   |
| `minY`      | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Minimum Y value. The scroller will not scroll past this point.   |
| `maxY`      | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Maximum Y value. The scroller will not scroll past this point.   |

### forceFinished

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun forceFinished(finished: Boolean): Unit
```

Force the finished field to a particular value.

|                                                       Parameters                                                       ||
|------------|------------------------------------------------------------------------------------------------------------|
| `finished` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html):The new finished value. |

### getCurrVelocity

Added in[API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun getCurrVelocity(): Float
```

Returns the current velocity.

|                                                                        Return                                                                        ||
|--------------------------------------------------------------------------------|----------------------------------------------------------------------|
| [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html) | The original velocity less the deceleration. Result may be negative. |

### getCurrX

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getCurrX(): Int
```

Returns the current X offset in the scroll.

|                                                                Return                                                                 ||
|----------------------------------------------------------------------------|-----------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | The new X offset as an absolute distance from the origin. |

### getCurrY

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getCurrY(): Int
```

Returns the current Y offset in the scroll.

|                                                                Return                                                                 ||
|----------------------------------------------------------------------------|-----------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | The new Y offset as an absolute distance from the origin. |

### getDuration

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getDuration(): Int
```

Returns how long the scroll event will take, in milliseconds.

|                                                         Return                                                          ||
|----------------------------------------------------------------------------|---------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | The duration of the scroll in milliseconds. |

### getFinalX

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getFinalX(): Int
```

Returns where the scroll will end. Valid only for "fling" scrolls.

|                                                                 Return                                                                  ||
|----------------------------------------------------------------------------|-------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | The final X offset as an absolute distance from the origin. |

### getFinalY

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getFinalY(): Int
```

Returns where the scroll will end. Valid only for "fling" scrolls.

|                                                                 Return                                                                  ||
|----------------------------------------------------------------------------|-------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | The final Y offset as an absolute distance from the origin. |

### getStartX

Added in[API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getStartX(): Int
```

Returns the start X offset in the scroll.

|                                                                 Return                                                                  ||
|----------------------------------------------------------------------------|-------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | The start X offset as an absolute distance from the origin. |

### getStartY

Added in[API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getStartY(): Int
```

Returns the start Y offset in the scroll.

|                                                                 Return                                                                  ||
|----------------------------------------------------------------------------|-------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | The start Y offset as an absolute distance from the origin. |

### isFinished

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun isFinished(): Boolean
```

Returns whether the scroller has finished scrolling.

|                                                                      Return                                                                       ||
|------------------------------------------------------------------------------------|---------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | True if the scroller has finished scrolling, false otherwise. |

### setFinalX

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setFinalX(newX: Int): Unit
```

Sets the final position (X) for this scroller.

|                                                                  Parameters                                                                  ||
|--------|--------------------------------------------------------------------------------------------------------------------------------------|
| `newX` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The new X offset as an absolute distance from the origin. |

**See Also**

- [#extendDuration(int)](https://developer.android.com/reference/kotlin/android/widget/Scroller#extendDuration(kotlin.Int))
- [#setFinalY(int)](https://developer.android.com/reference/kotlin/android/widget/Scroller#setFinalY(kotlin.Int))  

### setFinalY

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setFinalY(newY: Int): Unit
```

Sets the final position (Y) for this scroller.

|                                                                  Parameters                                                                  ||
|--------|--------------------------------------------------------------------------------------------------------------------------------------|
| `newY` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The new Y offset as an absolute distance from the origin. |

**See Also**

- [#extendDuration(int)](https://developer.android.com/reference/kotlin/android/widget/Scroller#extendDuration(kotlin.Int))
- [#setFinalX(int)](https://developer.android.com/reference/kotlin/android/widget/Scroller#setFinalX(kotlin.Int))  

### setFriction

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setFriction(friction: Float): Unit
```

The amount of friction applied to flings. The default value is[ViewConfiguration.getScrollFriction](https://developer.android.com/reference/kotlin/android/view/ViewConfiguration.html#getScrollFriction()).

|                                                                             Parameters                                                                             ||
|------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|
| `friction` | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html):A scalar dimension-less value representing the coefficient of friction. |

### startScroll

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun startScroll(
    startX: Int, 
    startY: Int, 
    dx: Int, 
    dy: Int
): Unit
```

Start scrolling by providing a starting point and the distance to travel. The scroll will use the default value of 250 milliseconds for the duration.

|                                                                                       Parameters                                                                                        ||
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `startX` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Starting horizontal scroll offset in pixels. Positive numbers will scroll the content to the left. |
| `startY` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Starting vertical scroll offset in pixels. Positive numbers will scroll the content up.            |
| `dx`     | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Horizontal distance to travel. Positive numbers will scroll the content to the left.               |
| `dy`     | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Vertical distance to travel. Positive numbers will scroll the content up.                          |

### startScroll

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun startScroll(
    startX: Int, 
    startY: Int, 
    dx: Int, 
    dy: Int, 
    duration: Int
): Unit
```

Start scrolling by providing a starting point, the distance to travel, and the duration of the scroll.

|                                                                                        Parameters                                                                                         ||
|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `startX`   | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Starting horizontal scroll offset in pixels. Positive numbers will scroll the content to the left. |
| `startY`   | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Starting vertical scroll offset in pixels. Positive numbers will scroll the content up.            |
| `dx`       | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Horizontal distance to travel. Positive numbers will scroll the content to the left.               |
| `dy`       | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Vertical distance to travel. Positive numbers will scroll the content up.                          |
| `duration` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Duration of the scroll in milliseconds.                                                            |

### timePassed

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun timePassed(): Int
```

Returns the time elapsed since the beginning of the scrolling.

|                                                    Return                                                     ||
|----------------------------------------------------------------------------|-----------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | The elapsed time in milliseconds. |