Search code examples
androidimageviewzooming

How can I get zoom functionality for images?


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:

  1. overwriting ImageView, that seems a little bit too much for such a common problem.
  2. using a webview but with less control over the overall layout etc.

Solution

  • I used a WebView and loaded the image from the memory via

    webview.loadUrl("file://...")
    

    The WebView handles all the panning zooming and scrolling. If you use wrap_content the webview won't be bigger then the image and no white areas are shown. The WebView is the better ImageView ;)