# LinearSmoothScroller

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:recyclerview-v7:28.0.0-alpha1  
Summary:[Constants](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#constants)\|[Fields](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#lfields)\|[Ctors](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#pubctors)\|[Methods](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#pubmethods)\|[Protected Methods](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#promethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#)  

# LinearSmoothScroller

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public


class
LinearSmoothScroller
`  
`


``

extends `[RecyclerView.SmoothScroller](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller)`


``


`

|---|---|------------------------------------------------|
| java.lang.Object                                     |||
| ↳ | [android.support.v7.widget.RecyclerView.SmoothScroller](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller) ||
|   | ↳ | android.support.v7.widget.LinearSmoothScroller |

<br />

*** ** * ** ***

[RecyclerView.SmoothScroller](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller)implementation which uses a[LinearInterpolator](https://developer.android.com/reference/android/view/animation/LinearInterpolator.html)until the target position becomes a child of the RecyclerView and then uses a[DecelerateInterpolator](https://developer.android.com/reference/android/view/animation/DecelerateInterpolator.html)to slowly approach to target position.

If the[RecyclerView.LayoutManager](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.LayoutManager)you are using does not implement the[RecyclerView.SmoothScroller.ScrollVectorProvider](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller.ScrollVectorProvider)interface, then you must override the[computeScrollVectorForPosition(int)](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller#computeScrollVectorForPosition(int))method. All the LayoutManagers bundled with the support library implement this interface.

## Summary

|                                                                                                                      ### Constants                                                                                                                      ||
|-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [SNAP_TO_ANY](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#SNAP_TO_ANY) <br /> Decides if the child should be snapped from start or end, depending on where it currently is in relation to its parent. |
| `int` | [SNAP_TO_END](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#SNAP_TO_END) Align child view's right or bottom with parent view's right or bottom                                                          |
| `int` | [SNAP_TO_START](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#SNAP_TO_START) Align child view's left or top with parent view's left or top                                                              |

|                                                                                                                                        ### Fields                                                                                                                                         ||
|-----------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
| ` protected final `[DecelerateInterpolator](https://developer.android.com/reference/android/view/animation/DecelerateInterpolator.html) | [mDecelerateInterpolator](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#mDecelerateInterpolator) <br /> |
| ` protected int`                                                                                                                        | [mInterimTargetDx](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#mInterimTargetDx) <br />               |
| ` protected int`                                                                                                                        | [mInterimTargetDy](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#mInterimTargetDy) <br />               |
| ` protected final `[LinearInterpolator](https://developer.android.com/reference/android/view/animation/LinearInterpolator.html)         | [mLinearInterpolator](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#mLinearInterpolator) <br />         |
| ` protected `[PointF](https://developer.android.com/reference/android/graphics/PointF.html)                                             | [mTargetVector](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#mTargetVector) <br />                     |

|                                                                                                                     ### Public constructors                                                                                                                      ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[LinearSmoothScroller](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#LinearSmoothScroller(android.content.Context))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` context) ` |

|                                                                                                                                                                                                                                                                                                                   ### Public methods                                                                                                                                                                                                                                                                                                                    ||
|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` int` | ` `[calculateDtToFit](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#calculateDtToFit(int, int, int, int, int))`(int viewStart, int viewEnd, int boxStart, int boxEnd, int snapPreference) ` Helper method for[calculateDxToMakeVisible(android.view.View, int)](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#calculateDxToMakeVisible(android.view.View, int))and[calculateDyToMakeVisible(android.view.View, int)](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#calculateDyToMakeVisible(android.view.View, int)) |
| ` int` | ` `[calculateDxToMakeVisible](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#calculateDxToMakeVisible(android.view.View, int))`(`[View](https://developer.android.com/reference/android/view/View.html)` view, int snapPreference) ` Calculates the horizontal scroll amount necessary to make the given view fully visible inside the RecyclerView.                                                                                                                                                                                                                                                    |
| ` int` | ` `[calculateDyToMakeVisible](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#calculateDyToMakeVisible(android.view.View, int))`(`[View](https://developer.android.com/reference/android/view/View.html)` view, int snapPreference) ` Calculates the vertical scroll amount necessary to make the given view fully visible inside the RecyclerView.                                                                                                                                                                                                                                                      |

|                                                                                                                                                                                                                                                                                                                              ### Protected methods                                                                                                                                                                                                                                                                                                                              ||
|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` float` | ` `[calculateSpeedPerPixel](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#calculateSpeedPerPixel(android.util.DisplayMetrics))`(`[DisplayMetrics](https://developer.android.com/reference/android/util/DisplayMetrics.html)` displayMetrics) ` Calculates the scroll speed.                                                                                                                                                                                                                                                                                                                                                  |
| ` int`   | ` `[calculateTimeForDeceleration](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#calculateTimeForDeceleration(int))`(int dx) ` <br /> Calculates the time for deceleration so that transition from LinearInterpolator to DecelerateInterpolator looks smooth.                                                                                                                                                                                                                                                                                                                                                                 |
| ` int`   | ` `[calculateTimeForScrolling](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#calculateTimeForScrolling(int))`(int dx) ` Calculates the time it should take to scroll the given distance (in pixels)                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ` int`   | ` `[getHorizontalSnapPreference](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#getHorizontalSnapPreference())`() ` 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.                                                                                                                                                                                                                                                                                                                                                    |
| ` int`   | ` `[getVerticalSnapPreference](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#getVerticalSnapPreference())`() ` 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.                                                                                                                                                                                                                                                                                                                                                        |
| ` void`  | ` `[onSeekTargetStep](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#onSeekTargetStep(int, int, android.support.v7.widget.RecyclerView.State, android.support.v7.widget.RecyclerView.SmoothScroller.Action))`(int dx, int dy, `[RecyclerView.State](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.State)` state, `[RecyclerView.SmoothScroller.Action](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller.Action)` action) ` <br /> RecyclerView will call this method each time it scrolls until it can find the target position in the layout.  |
| ` void`  | ` `[onStart](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#onStart())`() ` Called when smooth scroll is started.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ` void`  | ` `[onStop](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#onStop())`() ` Called when smooth scroller is stopped.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ` void`  | ` `[onTargetFound](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#onTargetFound(android.view.View, android.support.v7.widget.RecyclerView.State, android.support.v7.widget.RecyclerView.SmoothScroller.Action))`(`[View](https://developer.android.com/reference/android/view/View.html)` targetView, `[RecyclerView.State](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.State)` state, `[RecyclerView.SmoothScroller.Action](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller.Action)` action) ` Called when the target position is laid out. |
| ` void`  | ` `[updateActionForInterimTarget](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#updateActionForInterimTarget(android.support.v7.widget.RecyclerView.SmoothScroller.Action))`(`[RecyclerView.SmoothScroller.Action](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller.Action)` action) ` 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 methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#)From class` `[android.support.v7.widget.RecyclerView.SmoothScroller](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller)` ` |-------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[PointF](https://developer.android.com/reference/android/graphics/PointF.html)                                             | ` `[computeScrollVectorForPosition](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller#computeScrollVectorForPosition(int))`(int targetPosition) ` Compute the scroll vector for a given target position.                                                                                                                                                                                                                                                                                                                                                                                                                         | | ` `[View](https://developer.android.com/reference/android/view/View.html)                                                     | ` `[findViewByPosition](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller#findViewByPosition(int))`(int position) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | ` int`                                                                                                                        | ` `[getChildCount](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller#getChildCount())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | | ` int`                                                                                                                        | ` `[getChildPosition](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller#getChildPosition(android.view.View))`(`[View](https://developer.android.com/reference/android/view/View.html)` view) `                                                                                                                                                                                                                                                                                                                                                                                                                                   | | ` `[RecyclerView.LayoutManager](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.LayoutManager) | ` `[getLayoutManager](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller#getLayoutManager())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | | ` int`                                                                                                                        | ` `[getTargetPosition](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller#getTargetPosition())`() ` Returns the adapter position of the target item                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | | ` void`                                                                                                                       | ` `[instantScrollToPosition](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller#instantScrollToPosition(int))`(int position) ` *This method was deprecated in API level 24.1.0. Use[jumpTo(int)](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller.Action#jumpTo(int)).*                                                                                                                                                                                                                                                                                                              | | ` boolean`                                                                                                                    | ` `[isPendingInitialRun](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller#isPendingInitialRun())`() ` Returns true if SmoothScroller has been started but has not received the first animation callback yet.                                                                                                                                                                                                                                                                                                                                                                                                                    | | ` boolean`                                                                                                                    | ` `[isRunning](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller#isRunning())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | | ` void`                                                                                                                       | ` `[normalize](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller#normalize(android.graphics.PointF))`(`[PointF](https://developer.android.com/reference/android/graphics/PointF.html)` scrollVector) ` Normalizes the vector.                                                                                                                                                                                                                                                                                                                                                                                                    | | ` void`                                                                                                                       | ` `[onChildAttachedToWindow](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller#onChildAttachedToWindow(android.view.View))`(`[View](https://developer.android.com/reference/android/view/View.html)` child) `                                                                                                                                                                                                                                                                                                                                                                                                                    | | ` abstract void`                                                                                                              | ` `[onSeekTargetStep](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller#onSeekTargetStep(int, int, android.support.v7.widget.RecyclerView.State, android.support.v7.widget.RecyclerView.SmoothScroller.Action))`(int dx, int dy, `[RecyclerView.State](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.State)` state, `[RecyclerView.SmoothScroller.Action](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller.Action)` action) ` <br /> RecyclerView will call this method each time it scrolls until it can find the target position in the layout.  | | ` abstract void`                                                                                                              | ` `[onStart](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller#onStart())`() ` Called when smooth scroll is started.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | | ` abstract void`                                                                                                              | ` `[onStop](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller#onStop())`() ` Called when smooth scroller is stopped.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | | ` abstract void`                                                                                                              | ` `[onTargetFound](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller#onTargetFound(android.view.View, android.support.v7.widget.RecyclerView.State, android.support.v7.widget.RecyclerView.SmoothScroller.Action))`(`[View](https://developer.android.com/reference/android/view/View.html)` targetView, `[RecyclerView.State](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.State)` state, `[RecyclerView.SmoothScroller.Action](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller.Action)` action) ` Called when the target position is laid out. | | ` void`                                                                                                                       | ` `[setTargetPosition](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller#setTargetPosition(int))`(int targetPosition) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | | ` final void`                                                                                                                 | ` `[stop](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller#stop())`() ` Stops running the SmoothScroller in each animation callback.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## Constants

### SNAP_TO_ANY

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int SNAP_TO_ANY
```

<br />

Decides if the child should be snapped from start or end, depending on where it currently is in relation to its parent.

For instance, if the view is virtually on the left of RecyclerView, using`SNAP_TO_ANY`is the same as using`SNAP_TO_START`

<br />

<br />

**See also:**

- [calculateDtToFit(int, int, int, int, int)](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#calculateDtToFit(int, int, int, int, int))
- [calculateDxToMakeVisible(android.view.View, int)](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#calculateDxToMakeVisible(android.view.View, int))
- [calculateDyToMakeVisible(android.view.View, int)](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#calculateDyToMakeVisible(android.view.View, int))

Constant Value: 0 (0x00000000)  

### SNAP_TO_END

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int SNAP_TO_END
```

Align child view's right or bottom with parent view's right or bottom

<br />

**See also:**

- [calculateDtToFit(int, int, int, int, int)](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#calculateDtToFit(int, int, int, int, int))
- [calculateDxToMakeVisible(android.view.View, int)](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#calculateDxToMakeVisible(android.view.View, int))
- [calculateDyToMakeVisible(android.view.View, int)](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#calculateDyToMakeVisible(android.view.View, int))

Constant Value: 1 (0x00000001)  

### SNAP_TO_START

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int SNAP_TO_START
```

Align child view's left or top with parent view's left or top

<br />

**See also:**

- [calculateDtToFit(int, int, int, int, int)](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#calculateDtToFit(int, int, int, int, int))
- [calculateDxToMakeVisible(android.view.View, int)](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#calculateDxToMakeVisible(android.view.View, int))
- [calculateDyToMakeVisible(android.view.View, int)](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#calculateDyToMakeVisible(android.view.View, int))

Constant Value: -1 (0xffffffff)

## Fields

### mDecelerateInterpolator

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
DecelerateInterpolator mDecelerateInterpolator
```

<br />

<br />

### mInterimTargetDx

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int mInterimTargetDx
```

<br />

<br />

### mInterimTargetDy

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int mInterimTargetDy
```

<br />

<br />

### mLinearInterpolator

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
LinearInterpolator mLinearInterpolator
```

<br />

<br />

### mTargetVector

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
PointF mTargetVector
```

<br />

<br />

## Public constructors

### LinearSmoothScroller

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
LinearSmoothScroller (Context context)
```

<br />

<br />

|         Parameters          ||
|-----------|------------------|
| `context` | `Context` <br /> |

## Public methods

### calculateDtToFit

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int calculateDtToFit (int viewStart, 
                int viewEnd, 
                int boxStart, 
                int boxEnd, 
                int snapPreference)
```

Helper method for[calculateDxToMakeVisible(android.view.View, int)](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#calculateDxToMakeVisible(android.view.View, int))and[calculateDyToMakeVisible(android.view.View, int)](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#calculateDyToMakeVisible(android.view.View, int))

<br />

|           Parameters           ||
|------------------|--------------|
| `viewStart`      | `int` <br /> |
| `viewEnd`        | `int` <br /> |
| `boxStart`       | `int` <br /> |
| `boxEnd`         | `int` <br /> |
| `snapPreference` | `int` <br /> |

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### calculateDxToMakeVisible

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int calculateDxToMakeVisible (View view, 
                int snapPreference)
```

Calculates the horizontal scroll amount necessary to make the given view fully visible inside the RecyclerView.

<br />

|                                                                                                                                                                                                                               Parameters                                                                                                                                                                                                                                ||
|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `view`           | `View`: The view which we want to make fully visible <br />                                                                                                                                                                                                                                                                                                                                                                                           |
| `snapPreference` | `int`: The edge which the view should snap to when entering the visible area. One of[SNAP_TO_START](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#SNAP_TO_START),[SNAP_TO_END](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#SNAP_TO_END)or[SNAP_TO_END](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#SNAP_TO_END) <br /> |

|                                                   Returns                                                   ||
|-------|------------------------------------------------------------------------------------------------------|
| `int` | The vertical scroll amount necessary to make the view visible with the given snap preference. <br /> |

### calculateDyToMakeVisible

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int calculateDyToMakeVisible (View view, 
                int snapPreference)
```

Calculates the vertical scroll amount necessary to make the given view fully visible inside the RecyclerView.

<br />

|                                                                                                                                                                                                                                Parameters                                                                                                                                                                                                                                ||
|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `view`           | `View`: The view which we want to make fully visible <br />                                                                                                                                                                                                                                                                                                                                                                                            |
| `snapPreference` | `int`: The edge which the view should snap to when entering the visible area. One of[SNAP_TO_START](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#SNAP_TO_START),[SNAP_TO_END](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#SNAP_TO_END)or[SNAP_TO_ANY](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#SNAP_TO_ANY). <br /> |

|                                                   Returns                                                   ||
|-------|------------------------------------------------------------------------------------------------------|
| `int` | The vertical scroll amount necessary to make the view visible with the given snap preference. <br /> |

## Protected methods

### calculateSpeedPerPixel

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
float calculateSpeedPerPixel (DisplayMetrics displayMetrics)
```

Calculates the scroll speed.

<br />

|                                              Parameters                                              ||
|------------------|------------------------------------------------------------------------------------|
| `displayMetrics` | `DisplayMetrics`: DisplayMetrics to be used for real dimension calculations <br /> |

|                                                                                         Returns                                                                                         ||
|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `float` | The time (in ms) it should take for each pixel. For instance, if returned value is 2 ms, it means scrolling 1000 pixels with LinearInterpolation should take 2 seconds. <br /> |

### calculateTimeForDeceleration

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int calculateTimeForDeceleration (int dx)
```

<br />

Calculates the time for deceleration so that transition from LinearInterpolator to DecelerateInterpolator looks smooth.

<br />

<br />

|               Parameters               ||
|------|----------------------------------|
| `dx` | `int`: Distance to scroll <br /> |

|                                                           Returns                                                           ||
|-------|----------------------------------------------------------------------------------------------------------------------|
| `int` | Time for DecelerateInterpolator to smoothly traverse the distance when transitioning from LinearInterpolation <br /> |

### calculateTimeForScrolling

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int calculateTimeForScrolling (int dx)
```

Calculates the time it should take to scroll the given distance (in pixels)

<br />

|                          Parameters                           ||
|------|---------------------------------------------------------|
| `dx` | `int`: Distance in pixels that we want to scroll <br /> |

|              Returns               ||
|-------|-----------------------------|
| `int` | Time in milliseconds <br /> |

**See also:**

- [calculateSpeedPerPixel(android.util.DisplayMetrics)](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#calculateSpeedPerPixel(android.util.DisplayMetrics))  

### getHorizontalSnapPreference

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int getHorizontalSnapPreference ()
```

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.

<br />

|                                             Returns                                             ||
|-------|------------------------------------------------------------------------------------------|
| `int` | SNAP_TO_START, SNAP_TO_END or SNAP_TO_ANY; depending on the current target vector <br /> |

**See also:**

- [SNAP_TO_START](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#SNAP_TO_START)
- [SNAP_TO_END](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#SNAP_TO_END)
- [SNAP_TO_ANY](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#SNAP_TO_ANY)  

### getVerticalSnapPreference

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int getVerticalSnapPreference ()
```

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.

<br />

|                                             Returns                                             ||
|-------|------------------------------------------------------------------------------------------|
| `int` | SNAP_TO_START, SNAP_TO_END or SNAP_TO_ANY; depending on the current target vector <br /> |

**See also:**

- [SNAP_TO_START](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#SNAP_TO_START)
- [SNAP_TO_END](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#SNAP_TO_END)
- [SNAP_TO_ANY](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller#SNAP_TO_ANY)  

### onSeekTargetStep

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void onSeekTargetStep (int dx, 
                int dy, 
                RecyclerView.State state, 
                RecyclerView.SmoothScroller.Action action)
```

<br />

RecyclerView will call this method each time it scrolls until it can find the target position in the layout.

SmoothScroller should check dx, dy and if scroll should be changed, update the provided[RecyclerView.SmoothScroller.Action](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller.Action)to define the next scroll.

<br />

<br />

|                                                                     Parameters                                                                     ||
|----------|------------------------------------------------------------------------------------------------------------------------------------------|
| `dx`     | `int`: Last scroll amount horizontally <br />                                                                                            |
| `dy`     | `int`: Last scroll amount vertically <br />                                                                                              |
| `state`  | `RecyclerView.State`: Transient state of RecyclerView <br />                                                                             |
| `action` | `RecyclerView.SmoothScroller.Action`: If you want to trigger a new smooth scroll and cancel the previous one, update this object. <br /> |

### onStart

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void onStart ()
```

Called when smooth scroll is started. This might be a good time to do setup.

<br />

### onStop

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void onStop ()
```

Called when smooth scroller is stopped. This is a good place to cleanup your state etc.

<br />

### onTargetFound

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void onTargetFound (View targetView, 
                RecyclerView.State state, 
                RecyclerView.SmoothScroller.Action action)
```

Called when the target position is laid out. This is the last callback SmoothScroller will receive and it should update the provided[RecyclerView.SmoothScroller.Action](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller.Action)to define the scroll details towards the target view.

<br />

|                                                                       Parameters                                                                       ||
|--------------|------------------------------------------------------------------------------------------------------------------------------------------|
| `targetView` | `View`: The view element which render the target position. <br />                                                                        |
| `state`      | `RecyclerView.State`: Transient state of RecyclerView <br />                                                                             |
| `action`     | `RecyclerView.SmoothScroller.Action`: Action instance that you should update to define final scroll action towards the targetView <br /> |

### updateActionForInterimTarget

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void updateActionForInterimTarget (RecyclerView.SmoothScroller.Action action)
```

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.

<br />

|                      Parameters                       ||
|----------|---------------------------------------------|
| `action` | `RecyclerView.SmoothScroller.Action` <br /> |

**See also:**

- [computeScrollVectorForPosition(int)](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller#computeScrollVectorForPosition(int))  
-

  ## Annotations

  - [RecyclerView.EdgeEffectFactory.EdgeDirection](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.EdgeEffectFactory.EdgeDirection)
  - [RecyclerView.ItemAnimator.AdapterChanges](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ItemAnimator.AdapterChanges)
-

  ## Interfaces

  - [ActionMenuView.OnMenuItemClickListener](https://developer.android.com/reference/android/support/v7/widget/ActionMenuView.OnMenuItemClickListener)
  - [PopupMenu.OnDismissListener](https://developer.android.com/reference/android/support/v7/widget/PopupMenu.OnDismissListener)
  - [PopupMenu.OnMenuItemClickListener](https://developer.android.com/reference/android/support/v7/widget/PopupMenu.OnMenuItemClickListener)
  - [RecyclerView.ChildDrawingOrderCallback](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ChildDrawingOrderCallback)
  - [RecyclerView.ItemAnimator.ItemAnimatorFinishedListener](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ItemAnimator.ItemAnimatorFinishedListener)
  - [RecyclerView.LayoutManager.LayoutPrefetchRegistry](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.LayoutManager.LayoutPrefetchRegistry)
  - [RecyclerView.OnChildAttachStateChangeListener](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.OnChildAttachStateChangeListener)
  - [RecyclerView.OnItemTouchListener](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.OnItemTouchListener)
  - [RecyclerView.RecyclerListener](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.RecyclerListener)
  - [RecyclerView.SmoothScroller.ScrollVectorProvider](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller.ScrollVectorProvider)
  - [SearchView.OnCloseListener](https://developer.android.com/reference/android/support/v7/widget/SearchView.OnCloseListener)
  - [SearchView.OnQueryTextListener](https://developer.android.com/reference/android/support/v7/widget/SearchView.OnQueryTextListener)
  - [SearchView.OnSuggestionListener](https://developer.android.com/reference/android/support/v7/widget/SearchView.OnSuggestionListener)
  - [ShareActionProvider.OnShareTargetSelectedListener](https://developer.android.com/reference/android/support/v7/widget/ShareActionProvider.OnShareTargetSelectedListener)
  - [ThemedSpinnerAdapter](https://developer.android.com/reference/android/support/v7/widget/ThemedSpinnerAdapter)
  - [Toolbar.OnMenuItemClickListener](https://developer.android.com/reference/android/support/v7/widget/Toolbar.OnMenuItemClickListener)
-

  ## Classes

  - [ActionMenuView](https://developer.android.com/reference/android/support/v7/widget/ActionMenuView)
  - [ActionMenuView.LayoutParams](https://developer.android.com/reference/android/support/v7/widget/ActionMenuView.LayoutParams)
  - [AppCompatAutoCompleteTextView](https://developer.android.com/reference/android/support/v7/widget/AppCompatAutoCompleteTextView)
  - [AppCompatButton](https://developer.android.com/reference/android/support/v7/widget/AppCompatButton)
  - [AppCompatCheckBox](https://developer.android.com/reference/android/support/v7/widget/AppCompatCheckBox)
  - [AppCompatCheckedTextView](https://developer.android.com/reference/android/support/v7/widget/AppCompatCheckedTextView)
  - [AppCompatEditText](https://developer.android.com/reference/android/support/v7/widget/AppCompatEditText)
  - [AppCompatImageButton](https://developer.android.com/reference/android/support/v7/widget/AppCompatImageButton)
  - [AppCompatImageView](https://developer.android.com/reference/android/support/v7/widget/AppCompatImageView)
  - [AppCompatMultiAutoCompleteTextView](https://developer.android.com/reference/android/support/v7/widget/AppCompatMultiAutoCompleteTextView)
  - [AppCompatRadioButton](https://developer.android.com/reference/android/support/v7/widget/AppCompatRadioButton)
  - [AppCompatRatingBar](https://developer.android.com/reference/android/support/v7/widget/AppCompatRatingBar)
  - [AppCompatSeekBar](https://developer.android.com/reference/android/support/v7/widget/AppCompatSeekBar)
  - [AppCompatSpinner](https://developer.android.com/reference/android/support/v7/widget/AppCompatSpinner)
  - [AppCompatTextView](https://developer.android.com/reference/android/support/v7/widget/AppCompatTextView)
  - [CardView](https://developer.android.com/reference/android/support/v7/widget/CardView)
  - [DefaultItemAnimator](https://developer.android.com/reference/android/support/v7/widget/DefaultItemAnimator)
  - [DividerItemDecoration](https://developer.android.com/reference/android/support/v7/widget/DividerItemDecoration)
  - [GridLayout](https://developer.android.com/reference/android/support/v7/widget/GridLayout)
  - [GridLayout.Alignment](https://developer.android.com/reference/android/support/v7/widget/GridLayout.Alignment)
  - [GridLayout.LayoutParams](https://developer.android.com/reference/android/support/v7/widget/GridLayout.LayoutParams)
  - [GridLayout.Spec](https://developer.android.com/reference/android/support/v7/widget/GridLayout.Spec)
  - [GridLayoutManager](https://developer.android.com/reference/android/support/v7/widget/GridLayoutManager)
  - [GridLayoutManager.DefaultSpanSizeLookup](https://developer.android.com/reference/android/support/v7/widget/GridLayoutManager.DefaultSpanSizeLookup)
  - [GridLayoutManager.LayoutParams](https://developer.android.com/reference/android/support/v7/widget/GridLayoutManager.LayoutParams)
  - [GridLayoutManager.SpanSizeLookup](https://developer.android.com/reference/android/support/v7/widget/GridLayoutManager.SpanSizeLookup)
  - [LinearLayoutCompat](https://developer.android.com/reference/android/support/v7/widget/LinearLayoutCompat)
  - [LinearLayoutCompat.LayoutParams](https://developer.android.com/reference/android/support/v7/widget/LinearLayoutCompat.LayoutParams)
  - [LinearLayoutManager](https://developer.android.com/reference/android/support/v7/widget/LinearLayoutManager)
  - [LinearLayoutManager.LayoutChunkResult](https://developer.android.com/reference/android/support/v7/widget/LinearLayoutManager.LayoutChunkResult)
  - [LinearSmoothScroller](https://developer.android.com/reference/android/support/v7/widget/LinearSmoothScroller)
  - [LinearSnapHelper](https://developer.android.com/reference/android/support/v7/widget/LinearSnapHelper)
  - [ListPopupWindow](https://developer.android.com/reference/android/support/v7/widget/ListPopupWindow)
  - [OrientationHelper](https://developer.android.com/reference/android/support/v7/widget/OrientationHelper)
  - [PagerSnapHelper](https://developer.android.com/reference/android/support/v7/widget/PagerSnapHelper)
  - [PopupMenu](https://developer.android.com/reference/android/support/v7/widget/PopupMenu)
  - [RecyclerView](https://developer.android.com/reference/android/support/v7/widget/RecyclerView)
  - [RecyclerView.Adapter](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.Adapter)
  - [RecyclerView.AdapterDataObserver](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.AdapterDataObserver)
  - [RecyclerView.EdgeEffectFactory](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.EdgeEffectFactory)
  - [RecyclerView.ItemAnimator](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ItemAnimator)
  - [RecyclerView.ItemAnimator.ItemHolderInfo](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ItemAnimator.ItemHolderInfo)
  - [RecyclerView.ItemDecoration](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ItemDecoration)
  - [RecyclerView.LayoutManager](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.LayoutManager)
  - [RecyclerView.LayoutManager.Properties](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.LayoutManager.Properties)
  - [RecyclerView.LayoutParams](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.LayoutParams)
  - [RecyclerView.OnFlingListener](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.OnFlingListener)
  - [RecyclerView.OnScrollListener](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.OnScrollListener)
  - [RecyclerView.RecycledViewPool](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.RecycledViewPool)
  - [RecyclerView.Recycler](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.Recycler)
  - [RecyclerView.SimpleOnItemTouchListener](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SimpleOnItemTouchListener)
  - [RecyclerView.SmoothScroller](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller)
  - [RecyclerView.SmoothScroller.Action](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.SmoothScroller.Action)
  - [RecyclerView.State](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.State)
  - [RecyclerView.ViewCacheExtension](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ViewCacheExtension)
  - [RecyclerView.ViewHolder](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ViewHolder)
  - [RecyclerViewAccessibilityDelegate](https://developer.android.com/reference/android/support/v7/widget/RecyclerViewAccessibilityDelegate)
  - [RecyclerViewAccessibilityDelegate.ItemDelegate](https://developer.android.com/reference/android/support/v7/widget/RecyclerViewAccessibilityDelegate.ItemDelegate)
  - [SearchView](https://developer.android.com/reference/android/support/v7/widget/SearchView)
  - [ShareActionProvider](https://developer.android.com/reference/android/support/v7/widget/ShareActionProvider)
  - [SimpleItemAnimator](https://developer.android.com/reference/android/support/v7/widget/SimpleItemAnimator)
  - [SnapHelper](https://developer.android.com/reference/android/support/v7/widget/SnapHelper)
  - [StaggeredGridLayoutManager](https://developer.android.com/reference/android/support/v7/widget/StaggeredGridLayoutManager)
  - [StaggeredGridLayoutManager.LayoutParams](https://developer.android.com/reference/android/support/v7/widget/StaggeredGridLayoutManager.LayoutParams)
  - [SwitchCompat](https://developer.android.com/reference/android/support/v7/widget/SwitchCompat)
  - [ThemedSpinnerAdapter.Helper](https://developer.android.com/reference/android/support/v7/widget/ThemedSpinnerAdapter.Helper)
  - [Toolbar](https://developer.android.com/reference/android/support/v7/widget/Toolbar)
  - [Toolbar.LayoutParams](https://developer.android.com/reference/android/support/v7/widget/Toolbar.LayoutParams)
  - [Toolbar.SavedState](https://developer.android.com/reference/android/support/v7/widget/Toolbar.SavedState)
  - [TooltipCompat](https://developer.android.com/reference/android/support/v7/widget/TooltipCompat)