引入步骤:
1、在项目\build.gradle文件中加入如下代码:
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
2、在项目\app\build.gradle文件中加入如下代码:
dependencies {
implementation 'com.github.chrisbanes:PhotoView:2.0.0'
}
3、创建组件
android:id="@+id/pv"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
4、设置图片
PhotoView photoView = findViewById(R.id.pv);
photoView.setImageResource(R.mipmap.img);
效果图: