8

I have an Imageview(like a Magazine page).When i swype in to that image then i want the next image(page).Also want Zoom in and out option for this image.How i can achieve this?

Thanks

Jackson Chengalai
  • 3,907
  • 1
  • 24
  • 39

4 Answers4

3

Assuming you already researched separately on pinch-to-zoom and swipe gestures, you may want to impose limitations on useability. When the image is zoomed (occupying an area greater than the screen size), you should disable swipe detection, and enable it again once the image size is less than the screen size.

josephus
  • 8,284
  • 1
  • 37
  • 57
  • 2
    how can i detect whether it is a pinch zoom or swype gesture? – Jackson Chengalai Feb 16 '12 at 11:03
  • 2
    in detecting pinch zoom, you're using MotionEvent.ACTION_POINTER_DOWN to detect the second finger touching the screen. while there's no MotionEvent.ACTION_UP, whatever the onTouchEvent is processing should be a pinch gesture. try setting up flags to enable/disable swipe detection. that of course, in support to checking for the size of the image, as mentioned in my answer. – josephus Feb 16 '12 at 11:08
  • But it contradicts the scroll gesture. Isn't there a more generic way doing this? I mean one component with pinch to zoom and scroll. Another with swipe and make them work together. – AlikElzin-kilaka Sep 12 '12 at 13:51
2

I implemented such a library. There are still minor issues but it's functional and can be extended.

Here's the fork on github: https://github.com/kilaka/ImageViewZoom

Enjoy.

AlikElzin-kilaka
  • 34,335
  • 35
  • 194
  • 277
0

Found this post on a a gallery (swipe between photos) with pinch-to-zoom.

Community
  • 1
  • 1
AlikElzin-kilaka
  • 34,335
  • 35
  • 194
  • 277
0

I recently implemented it and it works great

https://github.com/chrisbanes/PhotoView

DroidBoy
  • 162
  • 1
  • 11