Search code examples
androidimageimageviewzoomingpan

Set Matrix minimum and maximum scale ImageView?


I have a code which zooms and pans the imageview matrix, it works well but i want the imageview to not be zoomed smaller than my screen, and i don't want it to be zoomed very much, i want to set a limit for zooming and to the same thing for dragging(panning) it should pan horizontally if image's width is larger than screen, and it should pan vertically if image's height is larger than the screen, how can i achieve this result ? i tried some methods from mike Ortiz's but i couldn't get them to work.


Solution

  • look into this library

    https://github.com/davemorrissey/subsampling-scale-image-view

    Highly configurable, easily extendable view with pan and zoom gestures for displaying huge images without loss of detail. Perfect for photo galleries, maps, building plans etc.