Is there a common way to show a big image and enable the user to zoom in and out and pan the image?
Until now I found two ways:
This is a very late addition to this thread but I've been working on an image view that supports zoom and pan and has a couple of features I haven't found elsewhere. This started out as a way of displaying very large images without causing OutOfMemoryError
s, by subsampling the image when zoomed out and loading higher resolution tiles when zoomed in. It now supports use in a ViewPager
, rotation manually or using EXIF information (90° stops), override of selected touch events using OnClickListener
or your own GestureDetector
or OnTouchListener
, subclassing to add overlays, pan while zooming, and fling momentum.
It's not intended as a general use replacement for ImageView
so doesn't extend it, and doesn't support display of images from resources, only assets and external files. It requires SDK 10.
Source is on GitHub, and there's a sample that illustrates use in a ViewPager
.
https://github.com/davemorrissey/subsampling-scale-image-view