RecyclerView.OnScrollListener


abstract class RecyclerView.OnScrollListener


An OnScrollListener can be added to a RecyclerView to receive messages when a scrolling event has occurred on that RecyclerView.

Summary

Public constructors

Public functions

Unit
onScrollStateChanged(recyclerView: RecyclerView, newState: Int)

Callback method to be invoked when RecyclerView's scroll state changes.

Unit
onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int)

Callback method to be invoked when the RecyclerView has been scrolled.

Public constructors

OnScrollListener

Added in 1.0.0
OnScrollListener()

Public functions

onScrollStateChanged

Added in 1.0.0
fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int): Unit

Callback method to be invoked when RecyclerView's scroll state changes.

Parameters
recyclerView: RecyclerView

The RecyclerView whose scroll state has changed.

newState: Int

The updated scroll state. One of SCROLL_STATE_IDLE, SCROLL_STATE_DRAGGING or SCROLL_STATE_SETTLING.

onScrolled

Added in 1.0.0
fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int): Unit

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

This callback will also be called if visible item range changes after a layout calculation. In that case, dx and dy will be 0.

Parameters
recyclerView: RecyclerView

The RecyclerView which scrolled.

dx: Int

The amount of horizontal scroll.

dy: Int

The amount of vertical scroll.