I have to display image in an imageview. And what I want to do is just simply pinch and zoom functionality on imageview.
Asked
Active
Viewed 5.0k times
16
-
Just go for link....you found some solution... http://stackoverflow.com/questions/8399296/how-to-implement-zoom-effect-for-image-view-in-android – Vasu Jun 03 '13 at 10:05
-
http://stackoverflow.com/questions/10128842/open-imageview-with-zoom-and-scroll – Gunaseelan Jun 03 '13 at 10:07
-
check out [this answer](http://stackoverflow.com/a/18221207/4251431) its awesome and `one line of code` – Basheer AL-MOMANI Apr 18 '16 at 16:10
3 Answers
33
You can use Chrisbanes photoview library:
-
I have done this just now. I only have the emulator for testing right now. Should click and drag with the mouse move the image? It doesn't. However, when I double-click, it zooms the image. – user2602079 Jan 05 '14 at 23:02
-
It also appears that zooming the image does not resize the image. So a lot of the image gets cropped out when it enlarges (From my double tap testing). Do you know any libraries to resize the image on pinch? I cannot find one. They all say pinch zoom. Not pinch resize/scale. Thanks – user2602079 Jan 05 '14 at 23:45
-
-
16
You can find below a link to a class created by Jason Polites that will allow you to handle pinch zooms on custom ImageViews: https://github.com/jasonpolites/gesture-imageview.
Just include this package into your application and then you will be able to use a custom GestureImaveView
in your XML files:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:gesture-image="http://schemas.polites.com/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.polites.android.GestureImageView
android:id="@+id/image"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/image"
gesture-image:min-scale="0.1"
gesture-image:max-scale="10.0"
gesture-image:strict="false"/>
This class handles pinch zooms, but also double taps.

Yoann Hercouet
- 17,894
- 5
- 58
- 85
-
1
-
Try this gesture library it comes with an out-of-the-box pan zoom mode: https://bitbucket.org/warwick/hacergestov3 – user2288580 Apr 24 '18 at 12:35
1
http://www.codeproject.com/Articles/319401/Simple-Gestures-on-Android
try this library it is really amazing it gives pich zoom rotate with the amazing smoothness and is much easy to use

Aashish Bhatnagar
- 2,595
- 2
- 22
- 37