前言
这是一个图片查看库,可以实现图片浏览功能,支持手势或者点击缩放的功能,支持在ViewPager中使用,允许应用程序通知照片上的用户点击
使用方法:
首先在根build.gradle文件添加
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
然后在模块build.gradle添加库
dependencies {
//这里说明一下,官方文档给出的latest.release.here是根据版本而设置的
implementation 'com.github.chrisbanes:PhotoView:latest.release.here'
}
接着再xml布局使用
<com.github.chrisbanes.photoview.PhotoView
android:id="@+id/photo_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
最后再java文件调用即可
PhotoView photoView = (PhotoView) findViewById(R.id.photo_view);
photoView.setImageResource(R.mipmap.ceshi);
如果联网操作的话记得加网络权限,好多人太马虎了