OnScrollListener

abstract class OnScrollListener
kotlin.Any
   ↳ androidx.recyclerview.widget.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 methods
open Unit
onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int)

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

open Unit
onScrollStateChanged(recyclerView: RecyclerView, newState: Int)

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

Public constructors

<init>

OnScrollListener()

Public methods

onScrolled

open 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 RecyclerView: The amount of horizontal scroll.
dy RecyclerView: The amount of vertical scroll.

onScrollStateChanged

open 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 RecyclerView: The updated scroll state. One of #SCROLL_STATE_IDLE, #SCROLL_STATE_DRAGGING or #SCROLL_STATE_SETTLING.