Hi, any suggestions on how we can achieve this loo...
# compose
u
Hi, any suggestions on how we can achieve this loopable pager/tab layout with
ScrollableTabRow
and
HorizontalPager
?
For pager, I was redirected to this sample which seemed like a hack with bounds at
Int.MAX_VALUE
w
I think the code linked in the sample seems reasonable. If you’re worried about someone scrolling too far you could have the selected value jump back around when it lands on an element above or below the threshold you’re expecting (that way you don’t need max_value, you just need a “dummy” page on the end that sent back to the first element when selected- I’ve seen both done before, and performance wise it shouldn’t make much of a difference).
🙏 1
u
you just need a “dummy” page on the end that sent back to the first element when selected-
Wouldn’t this cause a break or abrupt jump in the fluid animation of the view pager when the user is sent back from the right most page to the left most page?
w
you’d probably want to put it after landing, not when there was a chance of animation. I believe when I’d seen this before they had 2 pages in case the user overscrolled a bit.
🙆‍♂️ 1
u
Thank you for sharing these ideas. Let me give them a try! 🙇‍♂️