PhotoView源码解析系列一

2017-05-19  本文已影响543人  拙峰朽木

这一篇我们先来看看photoView整体的结构

简介:

github地址: https://github.com/chrisbanes/PhotoView
android项目依赖方式:

allprojects {
repositories {
    maven { url "https://jitpack.io" }
}

}
dependencies {
compile 'com.github.chrisbanes:PhotoView:latest.release.here'
}

简单使用方式:

<com.github.chrisbanes.photoview.PhotoView
android:id="@+id/photo_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

主要功能:
支持图片的缩放,移动,旋转

photoView源码架构

我们先来看下photoView源码的都有什么:

photoView源码结构.png

粗略的看了下整体结构,代码并不是很多,感觉主要就PhotoViewAttacher,PhotoView还有CustomGestureDetector这个三个类需要细看看。

本来以为PhotoView会是个核心类呢,结果打开代码一看:

photoView.class的代码结构.png

全是set,get方法,股摸着也不是具体实现,在到具体代码看看:

photoView.class具体实现.png

果然里面都是些对PhotoViewAttacher里方法的调用。
so, 我们的研究范围就又缩小了,只要研究PhotoViewAttacher.class和CustomGestureDetector.class就行了。

上一篇 下一篇

猜你喜欢

热点阅读