To add androidx viewpager2 bindings, import corbind-viewpager2
module:
dependencies {
implementation("ru.ldralighieri.corbind:corbind-viewpager2:1.11.0")
}
List of extensions
Component | Extension | Description |
---|---|---|
ViewPager2 | pageScrollEvents |
Called when the current page is scrolled, either as part of a programmatically initiated smooth scroll or a user initiated touch scroll. |
pageScrollStateChanges |
Called when the scroll state changes. | |
pageSelections |
Called when a new page becomes selected. |
Simple examples
vpSlides.pageSelections() // Flow<Int>
.onEach { tvMessage = "Page #$it selected" }
.flowWithLifecycle(lifecycle)
.launchIn(scope)
More examples in source code