0

I'm trying to create a stacked image gallery, this is a gallery on which all the pictures are overlaying each other in a stack(or pile), for example: a card pile, and the user would be able to see and touch just the upper image and to flip/throw it out of the screen(with translate animation). After throwing the first picture the user will see the second picture that was hidden underneath the first one and so on.

I didn't find a similar gallery in other apps except to "weheartpics" (for Iphone off course)

The line of solution that I'm following now is to create a FrameLayout, adding some overlaying pictures on it, to delete the upper picture when the user touch it(instead of throw it out of screen).

Nativ
  • 3,092
  • 6
  • 38
  • 69

4 Answers4

1

Use StackView, available on API Level 11 and higher.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
0

Why not use a ViewPager and flip through your images from left to right? You can then utilize FragmentStatePagerAdapter to prefetch and cache your images as use flips through these

Bostone
  • 36,858
  • 39
  • 167
  • 227
  • Because ViewPager gives a different solution than what i need. I don't want a "slide" gallery that you can browse between pictures, I want the user to touch the pic, move it around the screen and throwing it to the edge of the screen until the picture is not in range of the screen(this is the deletion process), than the user will see the second picture. – Nativ Oct 04 '12 at 08:55
0

All right - here's another way:

  1. Add ViewSwitcher with 2 ImageViews
  2. Since you can't use drag and drop library look for some alternatives but generally you want implement dragging the top image. Hopefully that will expose the hidden image but if not you will have to swap images when the drag starts
  3. Implement gesture performed listener to listen for the flick events on the top image
  4. When image is flicked away:

    a. Swap image views in ViewSwitcher (if not swapped already for the drag-n-drop)

    b. Pre-load next image into hidden ImageView

  5. Otherwise return top image into original location (don't load anything into hidden ImageView)
Community
  • 1
  • 1
Bostone
  • 36,858
  • 39
  • 167
  • 227
0

Ok, the solution for that problem was to use frameLayout and to add to it imageView from the code. It's easy to apply animations on the images and to remove/add them after the animation begins.

Nativ
  • 3,092
  • 6
  • 38
  • 69