Stay organized with collections
Save and categorize content based on your preferences.
public
static
interface
View.OnScrollChangeListener
android.view.View.OnScrollChangeListener
|
Interface definition for a callback to be invoked when the scroll
X or Y positions of a view change.
Note: Some views handle scrolling independently from View and may
have their own separate listeners for scroll-type events. For example,
ListView
allows clients to register an
AbsListView.OnScrollListener
to listen for changes in list scroll position.
Summary
Public methods |
abstract
void
|
onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY)
Called when the scroll position of a view changes.
|
Public methods
public abstract void onScrollChange (View v,
int scrollX,
int scrollY,
int oldScrollX,
int oldScrollY)
Called when the scroll position of a view changes.
Parameters |
v |
View : The view whose scroll position has changed. |
scrollX |
int : Current horizontal scroll origin. |
scrollY |
int : Current vertical scroll origin. |
oldScrollX |
int : Previous horizontal scroll origin. |
oldScrollY |
int : Previous vertical scroll origin. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# View.OnScrollChangeListener\n\nAdded in [API level 23](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nView.OnScrollChangeListener\n===========================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/view/View.OnScrollChangeListener \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nView.OnScrollChangeListener\n`\n\n\n`\n\n\n`\n\n|------------------------------------------|\n| android.view.View.OnScrollChangeListener |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nInterface definition for a callback to be invoked when the scroll\nX or Y positions of a view change.\n\n\n**Note:** Some views handle scrolling independently from View and may\nhave their own separate listeners for scroll-type events. For example,\n[ListView](/reference/android/widget/ListView) allows clients to register an\n[AbsListView.OnScrollListener](/reference/android/widget/AbsListView#setOnScrollListener(android.widget.AbsListView.OnScrollListener))\nto listen for changes in list scroll position. \n**See also:**\n\n- [View.setOnScrollChangeListener(View.OnScrollChangeListener)](/reference/android/view/View#setOnScrollChangeListener(android.view.View.OnScrollChangeListener))\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[onScrollChange](/reference/android/view/View.OnScrollChangeListener#onScrollChange(android.view.View,%20int,%20int,%20int,%20int))`(`[View](/reference/android/view/View)` v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) ` Called when the scroll position of a view changes. |\n\nPublic methods\n--------------\n\n### onScrollChange\n\nAdded in [API level 23](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onScrollChange (View v, \n int scrollX, \n int scrollY, \n int oldScrollX, \n int oldScrollY)\n```\n\nCalled when the scroll position of a view changes.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------------|------------------------------------------------------------|\n| `v` | `View`: The view whose scroll position has changed. \u003cbr /\u003e |\n| `scrollX` | `int`: Current horizontal scroll origin. \u003cbr /\u003e |\n| `scrollY` | `int`: Current vertical scroll origin. \u003cbr /\u003e |\n| `oldScrollX` | `int`: Previous horizontal scroll origin. \u003cbr /\u003e |\n| `oldScrollY` | `int`: Previous vertical scroll origin. \u003cbr /\u003e |"]]