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

# AbsListView.OnScrollListener

*** ** * ** ***

` public static interface AbsListView.OnScrollListener `   
` `

|---|
| android.widget.AbsListView.OnScrollListener |

<br />

*** ** * ** ***

Interface definition for a callback to be invoked when the list or grid has been scrolled.

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/widget/AbsListView.OnScrollListener#SCROLL_STATE_FLING` The user had previously been scrolling using touch and had performed a fling. |
| `int` | `https://developer.android.com/reference/android/widget/AbsListView.OnScrollListener#SCROLL_STATE_IDLE` The view is not scrolling. |
| `int` | `https://developer.android.com/reference/android/widget/AbsListView.OnScrollListener#SCROLL_STATE_TOUCH_SCROLL` The user is scrolling using touch, and their finger is still on the screen |

| ### Public methods ||
|---|---|
| ` abstract void` | ` https://developer.android.com/reference/android/widget/AbsListView.OnScrollListener#onScroll(android.widget.AbsListView,%20int,%20int,%20int)(https://developer.android.com/reference/android/widget/AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) ` Callback method to be invoked when the list or grid has been scrolled. |
| ` abstract void` | ` https://developer.android.com/reference/android/widget/AbsListView.OnScrollListener#onScrollStateChanged(android.widget.AbsListView,%20int)(https://developer.android.com/reference/android/widget/AbsListView view, int scrollState) ` Callback method to be invoked while the list view or grid view is being scrolled. |

## Constants

### SCROLL_STATE_FLING

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

```
public static final int SCROLL_STATE_FLING
```

The user had previously been scrolling using touch and had performed a fling. The animation is now coasting to a stop

<br />

Constant Value: 2 (0x00000002)

### SCROLL_STATE_IDLE

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

```
public static final int SCROLL_STATE_IDLE
```

The view is not scrolling. Note navigating the list using the trackball counts as being in the idle state since these transitions are not animated.

<br />

Constant Value: 0 (0x00000000)

### SCROLL_STATE_TOUCH_SCROLL

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

```
public static final int SCROLL_STATE_TOUCH_SCROLL
```

The user is scrolling using touch, and their finger is still on the screen

<br />

Constant Value: 1 (0x00000001)

## Public methods

### onScroll

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

```
public abstract void onScroll (AbsListView view, 
                int firstVisibleItem, 
                int visibleItemCount, 
                int totalItemCount)
```

Callback method to be invoked when the list or grid has been scrolled. This will be called after the scroll has completed

<br />

| Parameters ||
|---|---|
| `view` | `AbsListView`: The view whose scroll state is being reported <br /> |
| `firstVisibleItem` | `int`: the index of the first visible cell (ignore if visibleItemCount == 0) <br /> |
| `visibleItemCount` | `int`: the number of visible cells <br /> |
| `totalItemCount` | `int`: the number of items in the list adapter <br /> |

### onScrollStateChanged

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

```
public abstract void onScrollStateChanged (AbsListView view, 
                int scrollState)
```

Callback method to be invoked while the list view or grid view is being scrolled. If the view is being scrolled, this method will be called before the next frame of the scroll is rendered. In particular, it will be called before any calls to `https://developer.android.com/reference/android/widget/Adapter#getView(int,%20android.view.View,%20android.view.ViewGroup)`.

<br />

| Parameters ||
|---|---|
| `view` | `AbsListView`: The view whose scroll state is being reported <br /> |
| `scrollState` | `int`: The current scroll state. One of `https://developer.android.com/reference/android/widget/AbsListView.OnScrollListener#SCROLL_STATE_TOUCH_SCROLL` or `https://developer.android.com/reference/android/widget/AbsListView.OnScrollListener#SCROLL_STATE_IDLE`. <br /> |