Warm tip: This article is reproduced from stackoverflow.com, please click
android imageview zoom

How can I get zoom functionality for images?

发布于 2020-05-15 18:21:45

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.
Questioner
Janusz
Viewed
13
Janusz 2010-08-18 23:15

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 ;)