图片放大、缩小、旋转

1、在我们项目module build.gradle中配置

dependencies {
    compile 'com.github.chrisbanes:PhotoView:2.0.0'
}

在xml布局中引用该控件

<uk.co.senab.photoview.PhotoView
        android:id="@+id/photoview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

然后介绍下第二个

2、在我们项目module build.gradle中配置

dependencies {
    compile 'com.bm.photoview:library:1.4.1'
}

在xml布局中引用该控件

<com.bm.library.PhotoView
        android:id="@+id/photoview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

3.设置可以缩放,默认是不支持缩放的…

photoView.disenable();

使用

       PhotoView photoZhi = findViewById(R.id.photoview);
        photoZhi.setImageResource(R.mipmap.zhi);
        photoZhi.enable();
        photoZhi.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });

猜你喜欢

转载自blog.csdn.net/jiaosheng1/article/details/89634323