Question

Possible Duplicate:
Android - Can View Pager have multiple views in per page?

I'm using ViewPager according to this wonderful tutorial:

http://thepseudocoder.wordpress.com/2011/10/05/android-page-swiping-using-viewpager/

This tutorial shows how to display only one "page" or view in every time/swip.

How can I make something like the strip in Pulse app:

enter image description here

That have the snapping effect like ViewPager but can have multiple views inside?

Was it helpful?

Solution

It seems like the view pager only does one view at a time and can't have multiple views.

You can try to implement your own horizontal scroll view with your own fling and touch methods: http://blog.velir.com/index.php/2010/11/17/android-snapping-horizontal-scroll/

Or you can extend a Gallery which I think is what Pulse app is doing. Notice the snapping to position similarity of each item with the Gallery.

OTHER TIPS

Using LayoutInflater you can do what ever you want inside instantiateItem

  1. Create the xml you need to view
  2. Get and instance of LayoutInflater and inflate that xml on the page(s) you want
  3. Inside instantiateItem do the changes to the inflated views by calling inflatedviewname.findviewbyid

Checkout this line in my project

Let me know in the comments if you still need help

EDIT:

Maybe forget about the viewpager and use a horizontalscrollview but be careful about the item count and how you load them as it may take lots of memory the horizontal scroll view does some optimizations but they are not as good as he viewpager

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top