Stay organized with collections
Save and categorize content based on your preferences.
interface OnScrollListener
Interface to listen for the picker scroll state.
Summary
Constants |
static Int |
The user had previously been scrolling using touch and performed a fling.
|
static Int |
The view is not scrolling.
|
static Int |
The user is scrolling using touch, and their finger is still on the screen.
|
Public methods |
abstract Unit |
Callback invoked while the number picker scroll state has changed.
|
Constants
static val SCROLL_STATE_FLING: Int
The user had previously been scrolling using touch and performed a fling.
Value: 2
static val SCROLL_STATE_IDLE: Int
The view is not scrolling.
Value: 0
static val SCROLL_STATE_TOUCH_SCROLL: Int
The user is scrolling using touch, and their finger is still on the screen.
Value: 1
Public methods
abstract fun onScrollStateChange(
view: NumberPicker!,
scrollState: Int
): Unit
Callback invoked while the number picker scroll state has changed.
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,["# NumberPicker.OnScrollListener\n\nAdded in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nOnScrollListener\n================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/widget/NumberPicker.OnScrollListener \"View this page in Java\") \n\n```\ninterface OnScrollListener\n```\n\n|---------------------------------------------------|\n| [android.widget.NumberPicker.OnScrollListener](#) |\n\nInterface to listen for the picker scroll state.\n\nSummary\n-------\n\n| Constants ||\n|-----------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [SCROLL_STATE_FLING](#SCROLL_STATE_FLING:kotlin.Int) The user had previously been scrolling using touch and performed a fling. |\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [SCROLL_STATE_IDLE](#SCROLL_STATE_IDLE:kotlin.Int) The view is not scrolling. |\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [SCROLL_STATE_TOUCH_SCROLL](#SCROLL_STATE_TOUCH_SCROLL:kotlin.Int) The user is scrolling using touch, and their finger is still on the screen. |\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onScrollStateChange](#onScrollStateChange(android.widget.NumberPicker,%20kotlin.Int))`(`view:` `[NumberPicker](/reference/kotlin/android/widget/NumberPicker)!`, `scrollState:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Callback invoked while the number picker scroll state has changed. |\n\nConstants\n---------\n\n### SCROLL_STATE_FLING\n\nAdded in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val SCROLL_STATE_FLING: Int\n```\n\nThe user had previously been scrolling using touch and performed a fling. \n\n Value: 2\n\n### SCROLL_STATE_IDLE\n\nAdded in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val SCROLL_STATE_IDLE: Int\n```\n\nThe view is not scrolling. \n\n Value: 0\n\n### SCROLL_STATE_TOUCH_SCROLL\n\nAdded in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val SCROLL_STATE_TOUCH_SCROLL: Int\n```\n\nThe user is scrolling using touch, and their finger is still on the screen. \n\n Value: 1\n\nPublic methods\n--------------\n\n### onScrollStateChange\n\nAdded in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onScrollStateChange(\n view: NumberPicker!, \n scrollState: Int\n): Unit\n```\n\nCallback invoked while the number picker scroll state has changed.\n\n| Parameters ||\n|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `view` | [NumberPicker](/reference/kotlin/android/widget/NumberPicker)!: The view whose scroll state is being reported. |\n| `scrollState` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The current scroll state. One of [SCROLL_STATE_IDLE](#SCROLL_STATE_IDLE:kotlin.Int), [SCROLL_STATE_TOUCH_SCROLL](#SCROLL_STATE_TOUCH_SCROLL:kotlin.Int) or [SCROLL_STATE_IDLE](#SCROLL_STATE_IDLE:kotlin.Int). Value is [android.widget.NumberPicker.OnScrollListener#SCROLL_STATE_IDLE](#SCROLL_STATE_IDLE:kotlin.Int), [android.widget.NumberPicker.OnScrollListener#SCROLL_STATE_TOUCH_SCROLL](#SCROLL_STATE_TOUCH_SCROLL:kotlin.Int), or [android.widget.NumberPicker.OnScrollListener#SCROLL_STATE_FLING](#SCROLL_STATE_FLING:kotlin.Int) |"]]