3

I have implemented HorizontalPager with TabRow in my project. My HorizontalPager uses default fling behaviour from PagerDefaults.flingBehavior(state). I have not overridden the fling behavior.

This is how the code looks like:

    val pagerState = rememberPagerState()
    HorizontalPager(
                count = profileState.tabs.size,
                state = pagerState
            ) {..grid item..}

I have to scroll very hard to scroll between the pager items. I want the pager to scroll to next/previous screen on even slight scroll.

After debugging and logging, I found that initialVelocity in performFling method is coming out to be -0.0 (same for left and right fling) all the time for some reason.

Phil Dukhov
  • 67,741
  • 15
  • 184
  • 220
Abhishek Kumar
  • 4,532
  • 5
  • 31
  • 53

2 Answers2

0

You can use (with Accompanist version: accompanist-pager:0.24.8-beta):

  HorizontalPager(
        count = 3,
        state = pagerState,
        verticalAlignment = Alignment.Top,
        modifier = Modifier.fillMaxSize()
    )
Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
0

In my case, there was a horizontal scrollable Row in the pager item. Make it unscrollable.

eggham0518
  • 121
  • 1
  • 7