美文网首页
第三方库之 PhotoView

第三方库之 PhotoView

作者: Kevin_小飞象 | 来源:发表于2021-07-21 13:52 被阅读0次

效果图

01.png 02.png

功能

  • 支持两指缩放;
  • 支持单指移动。
  • 图片浏览查看
    GitHub 地址:PhotoView

配置

1. 在项目 build.gradle 添加

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url "https://jitpack.io"}
        jcenter()
    }
}

2. 在app 下build.gradle 添加

    // PhotoView
    implementation 'com.github.chrisbanes:PhotoView:2.0.0'

简单使用

  1. 布局文件
<com.github.chrisbanes.photoview.PhotoView
        android:id="@+id/photo_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
  1. 代码逻辑
public class ZoomActivity extends BaseActivity {
    @BindView(R.id.photo_view)
    PhotoView mPhotoView;

    @Override
    public int getLayoutId() {
        return R.layout.activity_zoom;
    }

    @Override
    public void initView() {
        mPhotoView.setImageResource(R.mipmap.meizi);
    }
}

相关文章

网友评论

      本文标题:第三方库之 PhotoView

      本文链接:https://www.haomeiwen.com/subject/dyalmltx.html