Android开发,实现图片缩放

1.添加依赖

implementation 'com.github.chrisbanes.photoview:library:1.2.4'

2.将xml文件中的ImageView控件替换成PhotoView

以前的:

<ImageView
        android:id="@+id/imageView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        tools:srcCompat="@tools:sample/avatars[2]" />

替换之后:

<uk.co.senab.photoview.PhotoView
        android:id="@+id/imageView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        tools:srcCompat="@tools:sample/avatars[2]" />

3.效果展示

在这里插入图片描述
在这里插入图片描述

发布了77 篇原创文章 · 获赞 40 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/y_dd6011/article/details/104172404