app项目开发过程中,大都有查看图片详情的功能模块。实现的方式一般都是通过viewpager+photoView+Glide的方式。这种方式下,如果碰到加载超长图,比如说高清版的清明上河图/世界地图,肯定就加载不出来了。
这个时候BitmapRegionDecoder就派上了用场了
原理:BitmapRegionDecoder允许从图片扣取一个图块加载,这就能很好的加载高清长图也能有效的防止内存溢出了。
布局文件
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/WHFull"
android:orientation="horizontal" android:layout_gravity="center">
<cn.isccn.ouyu.view.photoview.PhotoView style="@style/WHFull" android:scaleType="fitCenter"
android:id="@+id/ivPic"/>
<io.dcloud.feature.nativeObj.photoview.subscaleview.SubsamplingScaleImageView
style="@style/WHFull"
android:scaleType="fitCenter"
andro