17

I found a sample project of gallery with pinch zoom and made some bug fix. You can download my code at here

It supports full screen only. It always center the image to screen height. But I want to put a header view to the top of the screen and make the adjustment to the location of the image. The image location should be:

header height + (screen height - header height) / 2

I am not so good at using Matrix. Anyone has idea of how to make the customized gallery to work in any size (not just full screen)?

HitOdessit
  • 7,198
  • 4
  • 36
  • 59
mobile app Beginner
  • 1,651
  • 3
  • 26
  • 40
  • This is great stuff. Can you please explain the main fixes? – AlikElzin-kilaka Jul 26 '12 at 17:13
  • When i set the imageview scaltype to fitxy from Matrix, the zoom is not working..why is this happening – hemanth kumar Sep 30 '12 at 04:14
  • This is the best(and simplest) photo gallery I found, but it has some glitches, like images pushed to the right or bottom of the window after swiping or zooming. Also, it doesn't let you zoom all the way in. Also, it zooms out too much if the image is in low resolution. – AlikElzin-kilaka Oct 16 '12 at 15:01
  • 3
    You might have answers in this project: https://github.com/sephiroth74/ImageViewZoom. I think they calculate the height/width according to the ImageView and not screen size. – AlikElzin-kilaka Oct 16 '12 at 16:48

2 Answers2

2

You can use my Pinch to zoom Gallery project. You can choose any image from gallery and then in onDoubleTap(MotionEvent e) open full image and zoom it.

Artyom Kiriliyk
  • 2,513
  • 1
  • 17
  • 21
  • first of all +1 vote for your project link , i test it and working perfectly , but i have bounty question related to same subject can you check it please : http://stackoverflow.com/questions/18228934/infinite-gallery-images-with-double-tab-and-pinch-zoom , also how can i utilize your project to achieve zooming ability in my infinite gallery and does i need to use all classes in your project , thanks alot – Android Stack Aug 20 '13 at 08:49
0

You can do Image Zoom pinch option for gallery also by using below code lines:

case MotionEvent.ACTION_POINTER_DOWN:
    oldDist = spacing(event);
    Log.d(TAG, "oldDist=" + oldDist);
    if (oldDist > 10f) {
        savedMatrix.set(matrix);
        midPoint(mid, event);
        mode = ZOOM;
        Log.d(TAG, "mode=ZOOM" );
    }
    break;

Or you can download the example.

Ivan
  • 10,052
  • 12
  • 47
  • 78
Karthik
  • 167
  • 1
  • 5