# InterpolateOnScrollPositionChangeHelper

[View Source](https://github.com/material-components/material-components-android/blob/1.14.0/lib/java/com/google/android/material/shape/InterpolateOnScrollPositionChangeHelper.java)

*** ** * ** ***


```
public class InterpolateOnScrollPositionChangeHelper
```

<br />

*** ** * ** ***

Helper class to handle shape interpolation when shaped views enter or exit the window.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/com/google/android/material/shape/InterpolateOnScrollPositionChangeHelper#InterpolateOnScrollPositionChangeHelper(View,com.google.android.material.shape.MaterialShapeDrawable,ScrollView)( View shapedView, https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable materialShapeDrawable, ScrollView containingScrollView )` Instantiate a scroll position helper. |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/InterpolateOnScrollPositionChangeHelper#setContainingScrollView(ScrollView)(ScrollView containingScrollView)` Set the ScrollView which contains the View being interpolated. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/InterpolateOnScrollPositionChangeHelper#setMaterialShapeDrawable(com.google.android.material.shape.MaterialShapeDrawable)(https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable materialShapeDrawable)` Set the `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable` which will be interpolated. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/InterpolateOnScrollPositionChangeHelper#startListeningForScrollChanges(ViewTreeObserver)(ViewTreeObserver viewTreeObserver)` Start listening for scroll changes and interpolating based on position. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/InterpolateOnScrollPositionChangeHelper#stopListeningForScrollChanges(ViewTreeObserver)(ViewTreeObserver viewTreeObserver)` Stop listening for scroll changes and interpolating based on position. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/InterpolateOnScrollPositionChangeHelper#updateInterpolationForScreenPosition()()` Updates the `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable`'s interpolation based on the View's position in the containing ScrollView. |

## Public constructors

### InterpolateOnScrollPositionChangeHelper

```
public InterpolateOnScrollPositionChangeHelper(
    View shapedView,
    MaterialShapeDrawable materialShapeDrawable,
    ScrollView containingScrollView
)
```

Instantiate a scroll position helper.

| Parameters |
|---|---|
| `View shapedView` | the View whose background is a `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable` and which is scrolled in and out of view. |
| `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable materialShapeDrawable` | the `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable` which will be interpolated. |
| `ScrollView containingScrollView` | the ScrollView that contains shapedView. |

## Public methods

### setContainingScrollView

```
public void setContainingScrollView(ScrollView containingScrollView)
```

Set the ScrollView which contains the View being interpolated.

| Parameters |
|---|---|
| `ScrollView containingScrollView` |   |

### setMaterialShapeDrawable

```
public void setMaterialShapeDrawable(MaterialShapeDrawable materialShapeDrawable)
```

Set the `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable` which will be interpolated.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable materialShapeDrawable` | the desired drawable. |

### startListeningForScrollChanges

```
public void startListeningForScrollChanges(ViewTreeObserver viewTreeObserver)
```

Start listening for scroll changes and interpolating based on position.

| Parameters |
|---|---|
| `ViewTreeObserver viewTreeObserver` | belonging to the { } being interpolated. |

### stopListeningForScrollChanges

```
public void stopListeningForScrollChanges(ViewTreeObserver viewTreeObserver)
```

Stop listening for scroll changes and interpolating based on position.

| Parameters |
|---|---|
| `ViewTreeObserver viewTreeObserver` | belonging to the { } being interpolated. |

### updateInterpolationForScreenPosition

```
public void updateInterpolationForScreenPosition()
```

Updates the `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable`'s interpolation based on the View's position in the containing ScrollView.