如何在图像缩放android中捏缩放图像?

Wis*_*shy 16 android image zoom pinch

我必须在imageview中显示图像.我想要做的只是简单地在imageview上进行捏合和缩放功能.

Sha*_*dow 32

您可以使用Chrisbanes photoview库:

https://github.com/chrisbanes/PhotoView


Yoa*_*uet 16

您可以在下面找到由Jason Polites创建的类的链接,该类允许您处理自定义ImageView上的缩放缩放:https://github.com/jasonpolites/gesture-imageview.

只需将此包包含到您的应用程序中,然后您就可以GestureImaveView在XML文件中使用自定义:

<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"/>
Run Code Online (Sandbox Code Playgroud)

这个类处理捏缩放,但也可以双击.