1

I'm having some trouble with implementing a certain feature within my app. What I would like to achieve is being able to swipe up/down to see certain fragments.

I am currently using a ViewPager to scroll horizontally through three Fragments, using a FragmentStatePagerAdapter. Let's call these three fragments the "HorizontalFragments" (green in the image) - the user is able to navigate them by swiping left or right. Also, I have two "VerticalFragments" (orange in the image). What I would like the user to be able to do, is access those by swiping up or down, from any of the horizontal fragments.

enter image description here

I did have a look at the Umano AndroidSlidingUpPanel, but that only works for sliding a panel up, not swiping down.

Is there any way this is achievable? I would love to receive your input, also if there are better ways to approach the problem than by using Fragments, for example.

Thanks.

Jorn Rigter
  • 745
  • 1
  • 6
  • 25

1 Answers1

0

For anyone who is interested, the ViewPager2 class from Android X can do exactly this.

You can create a ViewPager2 with a vertical scroll orientation, with inside of it a nested ViewPager2 with a horizontal scroll orientation.

Jorn Rigter
  • 745
  • 1
  • 6
  • 25