Hi I am using the gallery f开发者_StackOverflow中文版or displaying images. But the gallery has an end. I don't want this behaviour; I want to repeat the images again and again on both sides of the gallery. Is there a way to display the gallery elements as a circle?
I wrote a tutorial on how to create circular gallery. Read it in my Blog Post here: http://evgeni-shafran.blogspot.com/2011/08/tutorial-custom-gallery-circular-and.html
Here is what i did:
In the adapter i used, i made him think he have a really big element count. and then each element position= position%element.lenght and then i made the first position in the middle.
so what happen is this: (lets do it for 3 elements, you can have what ever amount you like later) This is how the adapter see the elements:
1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3
now you tell him that the first element is in the middle:
1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,->1<-,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3
if you make it a really big number, the user can scroll a lot before getting to the end.
Hope it helped you.
精彩评论