3

I am looking if there are any ways to implement background image scrolling with ViewPager. What I want to achieve is shown on following video.

I've researched this, but it works kinda buggy (it also uses own ViewPager implementation).

Thank everyone in advance!

Community
  • 1
  • 1
user1256821
  • 1,158
  • 3
  • 15
  • 35

1 Answers1

2

See my answer there.

I don't think there is any way you can do it without extending ViewPager, the original implementation does not support this kind of feature.

Community
  • 1
  • 1
Matthieu
  • 16,103
  • 10
  • 59
  • 86
  • Thank you, it has worked! There were some issues so I had fix them manually, but now everything is awesome! – user1256821 Feb 06 '13 at 11:32
  • I am still working on it too (like this one: http://stackoverflow.com/questions/14715435/overriding-ondraw-for-viewpager-sometimes-gives-black-screen/14716799) and there is still some problem when the pages in the ViewPager change. If you fix some problems, I hope you can push them to that GitHub... – Matthieu Feb 06 '13 at 17:38
  • I've posted my version of ViewPagerParallax to [pastebin.com/AgqBb8pW](http://pastebin.com/AgqBb8pW). I've got rid of magic numbers like 4 and 5 that were in your version, and added the support of background images of any size. – user1256821 Feb 07 '13 at 15:11
  • I had made some other fix (using getScrollX instead of some black magic), otherwise it would run into problems when inserting pages "in the middle" of the adapter.... I just merged your changes in. Thanks! – Matthieu Feb 07 '13 at 18:20
  • You could add me to a contributors list, so I can push my further improvements (if any). [Me on github](https://github.com/bmaslakov) – user1256821 Feb 08 '13 at 09:13