0

I just discovered Rando app for Android today and I totally felt for the simple UI. I particularly like this sticky red button on their ViewPager:

enter image description here

I know how to make a sticky view over a ViewPager, placing it outside of the ViewPager in the same ViewGroup. But here the red button is partially sticky. When you scroll left, it's scrolling. When you go right, it keeps its position.

Apart from going the ugly way (having two ViewPagers (?!)), I have no idea how they made that. Custom view pager? maybe! Any idea?

Romain Piel
  • 11,017
  • 15
  • 71
  • 106

1 Answers1

1

I guess one idea would be to detect the page scrolling using onPageScrolled method, detect if scrolling direction is left or right, then manually update the position of the red circle accordingly.

See also: How to know viewpager is scroll left or right?

Community
  • 1
  • 1
Anup Cowkur
  • 20,443
  • 6
  • 51
  • 84