thanks, @flauschtrud To handle better swapping right on the last index or swapping left to the first index of your child tab layout, I use this code for a challenge when I wanted to change paging on nested tab layouts because SwipeChangeListener could not detect swap to the left & right when you were on the first index or the last index of the tab layout item
yourChildViewPager.registerOnPageChangeCallback(object :
OnPageChangeCallback() {
private var settled = false
override fun onPageScrollStateChanged(state: Int) {
super.onPageScrollStateChanged(state)
if (state == SCROLL_STATE_DRAGGING) {
settled = false
}
if (state == SCROLL_STATE_SETTLING) {
settled = true
}
if (state == SCROLL_STATE_IDLE && !settled) {
if (yourChildViewPager.currentItem == 0) {
backDirectionToParentViewPager()
} else {
forwardDirectionToParentViewPager()
}
}
}
})
Note: You can handle disable or enable paging in your parent view pager (ViewPager2) with this code:
yourParentViewPager.isUserInputEnabled = (true or false)