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:
I used a WebView and loaded the image from the memory via
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 ;)
I've just given TouchImageView a new update. It now includes Double Tap Zoom and Fling in addition to Panning and Pinch Zoom. The code below is very dated. You can check out the github project to get the latest code.
Place TouchImageView.java in your project. It can then be used the same as ImageView. Example:
TouchImageView img = (TouchImageView) findViewById(R.id.img);
If you are using TouchImageView in xml, then you must provide the full package name, because it is a custom view. Example:
<com.example.touch.TouchImageView android:id="@+id/img” android:layout_width="match_parent" android:layout_height="match_parent" />
Note: I've removed my prior answer, which included some very old code and now link straight to the most updated code on github.
If you are interested in putting TouchImageView in a ViewPager, refer to this answer.