对于手势放大缩小的ImageView,在网上找了一些,实现的大多差不多。但是缺少功能,于是在别人的基础上自己写了一个。
ZoomImageView
- 手势放大缩小
- 双击放大缩小
- 放大后手势移动
- 点击事件
- 与父控件的滑动冲突解决
看看效果


使用方式
在app的build.gradle中
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.ZYF99:UIKit:1.1'
}
在布局文件中直接使用
<com.zhangyf.zoomimageview.ZoomImageView
android:id="@+id/zoom_image"
android:layout_width="match_parent"
android:layout_height="match_parent" />
如果需要点击事件,这样写(kotlin)
zoomImageView.onClickAction = {
//Todo 点击事件
}
用的还行记得在这点个赞或者去github给个星星~
网友评论