How to implement "zoom in" and "zoom out" for imageView on Android?

0

I have an activity where I display an image at the screen size, however I needed to zoom in on the image, the same zoom as the Android system it has in all galleries and browsers on Android. Does anyone know how to do or what library to implement? Thank you in advance.

    
asked by anonymous 04.03.2016 / 21:35

1 answer

1

This custom class seems to do what you want:

link

Have some ideas on how to implement zero zoom, in this post in English:

link

The basic forms are:

1) change the bounds, that is, the rectangle in which the ImageView is drawn. By specifying a large bounds, the image will be drawn magnified. It no will take the entire screen if the ImageView is inside another view with a limited size (the visible part of the image is the bounds of the view it contains). In iOS the equivalent trick works fine (in iOS, it is not "bounds", it is "frame").

2) use a transform, via setImageMatrix (). The advantage is that this setImageMatrix () method is specific to ImageView, and acts directly on the image, the "bounds" of the View does not need to be tweaked and is respected (the image will not overflow to the entire screen if it is magnified, for example, and you do not need another view containing ImageView to "clip" as you would need in Method 1). >     

04.03.2016 / 23:09