I have to display image in an imageview. And what I want to do is just simply pinch and zoom functionality on imageview.
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.
You can use Chrisbanes photoview library:
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.
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
© 2022 - 2024 — McMap. All rights reserved.
one line of code
– Araldo