I am developing gallery for promotions. I am showing images thumbnail, And onclick image becomes fullscreen. Now i want to swipe this image to sh开发者_JAVA技巧ow next fullscreen. I have swiped already by using location. But it shows next image directly without any swiping /visual effect /transition. Please help me.
Are you trying to implement a carousel? While The way I'd go about doing this would be to pack the previous, current, and next image into a horizontal scroller (containg only these three child images). Set scroller snapping to true. Set up a listener, which will switch the images in the scroller.
For example, given nine images, and assuming we start by looking at the fifth images, the scroller will look like this:
1 2 3 4[5]6 7 8 9
If the user swipes left, the scroller will snap to image 6. Ideally, we have this model:
1 2 3 4 5[6]7 8 9
However, it is not always practical to load all images into memory at the same time. In this case, the scroller is populated like this: 4[5]6 When the user scrolls to view image 6, we load a new image after six (if available), and then remove image 4. The scroller now looks like this:
5[6]7
This should provide basic carousel behavior. The listener can simply not load the next image when the user reaches the ends of the image list, and the scroller will prohibit scrolling out of bounds.
精彩评论