# ScrollFeedbackProviderCompat

# ScrollFeedbackProviderCompat

Artifact:[androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core)  
[View Source](https://cs.android.com/search?q=file:androidx/core/view/ScrollFeedbackProviderCompat.java+class:androidx.core.view.ScrollFeedbackProviderCompat)  
Added in[1.16.0](https://developer.android.com/jetpack/androidx/releases/core#1.16.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/core/view/ScrollFeedbackProviderCompat "View this page in Java")

<br />

```
class ScrollFeedbackProviderCompat
```

<br />

*** ** * ** ***

Compat to access[ScrollFeedbackProvider](https://developer.android.com/reference/android/view/ScrollFeedbackProvider.html)across different build versions.

## Summary

|                                                             ### Public functions                                                             |
|----------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static `[ScrollFeedbackProviderCompat](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollFeedbackProviderCompat) | [createProvider](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollFeedbackProviderCompat#createProvider(android.view.View))`(view: `[View](https://developer.android.com/reference/android/view/View.html)`)` Creates an instance of[ScrollFeedbackProviderCompat](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollFeedbackProviderCompat).                                                                                                                                                                                           |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                | [onScrollLimit](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollFeedbackProviderCompat#onScrollLimit(int,int,int,boolean))`(inputDeviceId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, source: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, axis: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, isStart: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Call this when the view has reached the scroll limit. |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                | [onScrollProgress](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollFeedbackProviderCompat#onScrollProgress(int,int,int,int))`(` ` inputDeviceId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` source: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` axis: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` deltaInPixels: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) `)` Call this when the view has scrolled.   |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                | [onSnapToItem](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollFeedbackProviderCompat#onSnapToItem(int,int,int))`(inputDeviceId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, source: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, axis: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Call this when the view has snapped to an item.                                                                                                                 |

## Public functions

### createProvider

Added in[1.16.0](https://developer.android.com/jetpack/androidx/releases/core#1.16.0)  

```
java-static fun createProvider(view: View): ScrollFeedbackProviderCompat
```

Creates an instance of[ScrollFeedbackProviderCompat](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollFeedbackProviderCompat).  

### onScrollLimit

Added in[1.16.0](https://developer.android.com/jetpack/androidx/releases/core#1.16.0)  

```
fun onScrollLimit(inputDeviceId: Int, source: Int, axis: Int, isStart: Boolean): Unit
```

Call this when the view has reached the scroll limit.

Note that a feedback may not be provided on every call to this method. This interface, for instance, may provide feedback on every \`N\`th scroll limit event. For the interface to properly provide feedback when needed, call this method for each scroll limit event that you want to be accounted to scroll limit feedback.  

|                                           Parameters                                           |
|------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `inputDeviceId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)   | the ID of the[InputDevice](https://developer.android.com/reference/android/view/InputDevice.html)that caused scrolling to hit limit.                                                                                                                                                                                                                                                                          |
| `source: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)          | the input source of the motion that caused scrolling to hit the limit.                                                                                                                                                                                                                                                                                                                                        |
| `axis: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)            | the axis of`event`that caused scrolling to hit the limit.                                                                                                                                                                                                                                                                                                                                                     |
| `isStart: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | `true`if scrolling hit limit at the start of the scrolling list, and`false`if the scrolling hit limit at the end of the scrolling list.*start* and*end*in this context are not geometrical references. Instead, they refer to the start and end of a scrolling experience. As such, "start" for some views may be at the bottom of a scrolling list, while it may be at the top of scrolling list for others. |

### onScrollProgress

Added in[1.16.0](https://developer.android.com/jetpack/androidx/releases/core#1.16.0)  

```
fun onScrollProgress(
    inputDeviceId: Int,
    source: Int,
    axis: Int,
    deltaInPixels: Int
): Unit
```

Call this when the view has scrolled.

Different axes have different ways to map their raw axis values to pixels for scrolling. When calling this method, use the scroll values in pixels by which the view was scrolled; do not use the raw axis values. That is, use whatever value is passed to one of View's scrolling methods (example:[scrollBy](https://developer.android.com/reference/android/view/View.html#scrollBy(int, int))). For example, for vertical scrolling on[AXIS_SCROLL](https://developer.android.com/reference/android/view/MotionEvent.html#AXIS_SCROLL()), convert the raw axis value to the equivalent pixels by using[getScaledVerticalScrollFactor](https://developer.android.com/reference/android/view/ViewConfiguration.html#getScaledVerticalScrollFactor()), and use that value for this method call.

Note that a feedback may not be provided on every call to this method. This interface, for instance, may provide feedback for every \`x\` pixels scrolled. For the interface to properly track scroll progress and provide feedback when needed, call this method for each scroll event that you want to be accounted to scroll feedback.  

|                                          Parameters                                          |
|----------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|
| `inputDeviceId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | the ID of the[InputDevice](https://developer.android.com/reference/android/view/InputDevice.html)that caused scroll progress. |
| `source: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)        | the input source of the motion that caused scroll progress.                                                                   |
| `axis: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)          | the axis of`event`that caused scroll progress.                                                                                |
| `deltaInPixels: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | the amount of scroll progress, in pixels.                                                                                     |

### onSnapToItem

Added in[1.16.0](https://developer.android.com/jetpack/androidx/releases/core#1.16.0)  

```
fun onSnapToItem(inputDeviceId: Int, source: Int, axis: Int): Unit
```

Call this when the view has snapped to an item.  

|                                          Parameters                                          |
|----------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| `inputDeviceId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | the ID of the[InputDevice](https://developer.android.com/reference/android/view/InputDevice.html)that generated the motion triggering the snap. |
| `source: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)        | the input source of the motion causing the snap.                                                                                                |
| `axis: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)          | the axis of`event`that caused the item to snap.                                                                                                 |