第一步:导入依赖
implementation 'com.bm.photoview:library:1.4.1'
第二步:XML布局
xmlns:tools="http://schemas.android.com/tools"
<com.bm.library.PhotoView
android:id="@+id/photoview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:adjustViewBounds="true"
tools:src="@mipmap/ic_launcher"
tools:targetApi="lollipop"></com.bm.library.PhotoView>
第三步:
PhotoView photoview= this.findViewById(R.id.photoview);
ButterKnife.bind(this);
//传过来的url地址
Intent intent = getIntent();
String url = intent.getStringExtra("key");
photoview.enable();
Glide.with(this).load(url).into(photoview);