RecyclerView.OnScrollListener
public 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 methods |
|
|---|---|
void |
onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState)Callback method to be invoked when RecyclerView's scroll state changes. |
void |
onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy)Callback method to be invoked when the RecyclerView has been scrolled. |
Public constructors
Public methods
onScrollStateChanged
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState)
Callback method to be invoked when RecyclerView's scroll state changes.
| Parameters | |
|---|---|
@NonNull RecyclerView recyclerView |
The RecyclerView whose scroll state has changed. |
int newState |
The updated scroll state. One of |
onScrolled
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy)
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 | |
|---|---|
@NonNull RecyclerView recyclerView |
The RecyclerView which scrolled. |
int dx |
The amount of horizontal scroll. |
int dy |
The amount of vertical scroll. |