一个图片浏览器,支持超大图、超长图、支持手势放大、支持查看原图、下载、加载百分比进度显示。采用区块复用加载,优化内存占用,有效避免OOM。
- 支持多张图片(网络图片)滑动浏览,支持手势放大、双击放大。
- 支持下载,支持自定义下载目录文件夹名称。
- 查看原图支持加载进度条显示
- 支持超大图、超长图,sample中测试的大图尺寸分别是:2280 * 22116、5760 * 3840。
- 采用区块加载,不用担心OOM的风险。
Step 1. Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.SherlockGougou:BigImageViewPager:v0.0.2'
}
生成图片源:
ImageInfo imageInfo;
final List<ImageInfo> imageInfoList = new ArrayList<>();
for (int i = 0; i < images.length; i++) {
imageInfo = new ImageInfo();
imageInfo.setOriginUrl(images[i]);// 原图
imageInfo.setThumbnailUrl(images[i].concat("-1200"));// 缩略图,实际使用中,根据需求传入缩略图路径
imageInfoList.add(imageInfo);
imageInfo = null;
}
链式调用,多种配置
ImagePreview
.getInstance()
.setContext(MainActivity.this)// 上下文
.setIndex(0)// 默认显示的索引
.setImageInfoList(imageInfoList)// 图片集合
.setShowDownButton(true)// 是否显示下载按钮
.setShowOriginButton(true)// 是否显示原图按钮
.setFolderName("BigImageViewDownload")// 下载到的文件夹名字
.start();// 调用完成,开始跳转
- 增加本地图片浏览功能
- 自定义主题