# ListViewAutoScrollHelper

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

*** ** * ** ***


```
public class ListViewAutoScrollHelper extends AutoScrollHelper
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.core.widget.AutoScrollHelper](https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper) ||
|   | ↳ | [androidx.core.widget.ListViewAutoScrollHelper](https://developer.android.com/reference/androidx/core/widget/ListViewAutoScrollHelper) |

*** ** * ** ***

An implementation of `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper` that knows how to scroll through a `https://developer.android.com/reference/android/widget/ListView.html`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/core/widget/ListViewAutoScrollHelper#ListViewAutoScrollHelper(android.widget.ListView)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/widget/ListView.html target)` |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/core/widget/ListViewAutoScrollHelper#canTargetScrollHorizontally(int)(int direction)` Override this method to return whether the target view can be scrolled horizontally in a certain direction. |
| `boolean` | `https://developer.android.com/reference/androidx/core/widget/ListViewAutoScrollHelper#canTargetScrollVertically(int)(int direction)` Override this method to return whether the target view can be scrolled vertically in a certain direction. |
| `void` | `https://developer.android.com/reference/androidx/core/widget/ListViewAutoScrollHelper#scrollTargetBy(int,int)(int deltaX, int deltaY)` Override this method to scroll the target view by the specified number of pixels. |

| ### Inherited Constants |
|---|
| From [androidx.core.widget.AutoScrollHelper](https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper) |---|---| | `static final int` | `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#EDGE_TYPE_INSIDE() = 0` Edge type that specifies an activation area starting at the view bounds and extending inward. | | `static final int` | `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#EDGE_TYPE_INSIDE_EXTEND() = 1` Edge type that specifies an activation area starting at the view bounds and extending inward. | | `static final int` | `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#EDGE_TYPE_OUTSIDE() = 2` Edge type that specifies an activation area starting at the view bounds and extending outward. | | `static final float` | `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#NO_MAX() = 3.4028235E38f` Constant passed to `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#setMaximumEdges(float,float)`, `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#setMaximumVelocity(float,float)`, or `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#setMinimumVelocity(float,float)`. | | `static final float` | `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#NO_MIN() = 0.0f` Constant passed to `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#setMaximumEdges(float,float)`, or `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#setMaximumVelocity(float,float)`, or `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#setMinimumVelocity(float,float)`. | | `static final float` | `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#RELATIVE_UNSPECIFIED() = 0.0f` Constant passed to `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#setRelativeEdges(float,float)` or `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#setRelativeVelocity(float,float)`. | |

| ### Inherited methods |
|---|
| From [androidx.core.widget.AutoScrollHelper](https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper) |---|---| | `boolean` | `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#isEnabled()()` | | `boolean` | `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#isExclusive()()` Indicates whether the scroll helper handles touch events exclusively during scrolling. | | `boolean` | `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#onTouch(android.view.View,android.view.MotionEvent)(https://developer.android.com/reference/android/view/View.html v, https://developer.android.com/reference/android/view/MotionEvent.html event)` Handles touch events by activating automatic scrolling, adjusting scroll velocity, or stopping. | | `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper` | `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#setActivationDelay(int)(int delayMillis)` Sets the delay after entering an activation edge before activation of auto-scrolling. | | `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper` | `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#setEdgeType(int)(int type)` Sets the activation edge type, one of: | | `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper` | `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#setEnabled(boolean)(boolean enabled)` Sets whether the scroll helper is enabled and should respond to touch events. | | `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper` | `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#setExclusive(boolean)(boolean exclusive)` Enables or disables exclusive handling of touch events during scrolling. | | `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper` | `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#setMaximumEdges(float,float)(float horizontalMax, float verticalMax)` Sets the absolute maximum edge size. | | `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper` | `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#setMaximumVelocity(float,float)(float horizontalMax, float verticalMax)` Sets the absolute maximum scrolling velocity. | | `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper` | `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#setMinimumVelocity(float,float)(float horizontalMin, float verticalMin)` Sets the absolute minimum scrolling velocity. | | `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper` | `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#setRampDownDuration(int)(int durationMillis)` Sets the amount of time after de-activation of auto-scrolling that is takes to slow to a stop. | | `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper` | `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#setRampUpDuration(int)(int durationMillis)` Sets the amount of time after activation of auto-scrolling that is takes to reach target velocity for the current touch position. | | `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper` | `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#setRelativeEdges(float,float)(float horizontal, float vertical)` Sets the activation edge size relative to the host view's dimensions. | | `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper` | `https://developer.android.com/reference/androidx/core/widget/AutoScrollHelper#setRelativeVelocity(float,float)(float horizontal, float vertical)` Sets the target scrolling velocity relative to the host view's dimensions. | |
| From [android.view.View.OnTouchListener](https://developer.android.com/reference/android/view/View.OnTouchListener.html) |---|---| | `abstract boolean` | `https://developer.android.com/reference/android/view/View.OnTouchListener.html#onTouch(android.view.View, android.view.MotionEvent)(https://developer.android.com/reference/android/view/View.html p, https://developer.android.com/reference/android/view/MotionEvent.html p1)` | |

## Public constructors

### ListViewAutoScrollHelper

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

```
public ListViewAutoScrollHelper(@NonNull ListView target)
```

## Public methods

### canTargetScrollHorizontally

```
public boolean canTargetScrollHorizontally(int direction)
```

Override this method to return whether the target view can be scrolled horizontally in a certain direction.

| Parameters |
|---|---|
| `int direction` | Negative to check scrolling left, positive to check scrolling right. |

| Returns |
|---|---|
| `boolean` | true if the target view is able to horizontally scroll in the specified direction. |

### canTargetScrollVertically

```
public boolean canTargetScrollVertically(int direction)
```

Override this method to return whether the target view can be scrolled vertically in a certain direction.

| Parameters |
|---|---|
| `int direction` | Negative to check scrolling up, positive to check scrolling down. |

| Returns |
|---|---|
| `boolean` | true if the target view is able to vertically scroll in the specified direction. |

### scrollTargetBy

```
public void scrollTargetBy(int deltaX, int deltaY)
```

Override this method to scroll the target view by the specified number of pixels.

| Parameters |
|---|---|
| `int deltaX` | The number of pixels to scroll by horizontally. |
| `int deltaY` | The number of pixels to scroll by vertically. |