2 Star 22 Fork 5

Jenly / ImageViewer

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

ImageViewer

Image

Download MavenCentral JCenter JitPack CI CircleCI API License Blog QQGroup

ImageViewer for Android 是一个图片查看器,一般用来查看图片详情或查看大图时使用。

Gif 展示

Image

引入

Gradle:

  1. 在Project的 build.gradlesetting.gradle 中添加远程仓库

    repositories {
        //...
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
  2. 在Module的 build.gradle 里面添加引入依赖项

    implementation 'com.github.jenly1314:imageviewer:1.1.0'

示例

代码示例

    //图片查看器 - 简单调用

// data 可以多张图片List或单张图片,支持的类型可以是{@link Uri}, {@code url}, {@code path},{@link File}, {@link DrawableRes resId}…等
    ImageViewer.load(data)//要加载的图片数据,单张或多张
            .imageLoader(new GlideImageLoader())//加载器,imageLoader必须配置,目前内置的有GlideImageLoader或PicassoImageLoader,也可以自己实现
            .start(activity,sharedElement);//activity or fragment, 跳转时的共享元素视图
    //图片查看器

// data 可以多张图片List或单张图片,支持的类型可以是{@link Uri}, {@code url}, {@code path},{@link File}, {@link DrawableRes resId}…等
    ImageViewer.load(data)//要加载的图片数据,单张或多张
            .selection(position)//当前选中位置,默认:0
            .indicator(true)//是否显示指示器,默认不显示
            .imageLoader(new GlideImageLoader())//加载器,imageLoader必须配置,目前内置的有GlideImageLoader或PicassoImageLoader,也可以自己实现
            .theme(R.style.ImageViewerTheme)//设置主题风格,默认:R.style.ImageViewerTheme
            .orientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)//设置屏幕方向,默认:ActivityInfo.SCREEN_ORIENTATION_BEHIND
            .start(activity,sharedElement);//activity or fragment, 跳转时的共享元素视图

相关说明

  • 使用 ImageViewer 时,必须配置一个实现的 ImageLoader

  • ImageViewer 一次可以查看多张图片或单张图片,支持的类型可以是 UriurlpathFileDrawableResImageDataSource 等。

  • 目前内置默认实现 ImageLoader 的有 GlideImageLoaderPicassoImageLoader ,二者选其一即可,如果二者不满足您的需求,您也可以自己实现一个 ImageLoader

  • 为了保证 ImageViewer 体积最小化,让用户有更多选择的可能性, ImageViewer 仅编译时用到了 GlidePicasso

当你使用了 GlideImageLoader 时,则需依赖 Glide 库。

当你使用了 PicassoImageLoader 时,则需依赖 Picasso 库。

更多使用详情,请查看app中的源码使用示例

版本记录

v1.1.0:2023-9-16

  • 更新Gradle至v7.3.3
  • 更新compileSdk至30
  • 优化细节

v1.0.4:2022-9-11

  • 优化细节

v1.0.3:2022-9-10 (从v1.0.3开始发布至 MavenCentral)

  • 看大图界面支持自定义扩展

v1.0.2:2020-12-3

  • 加载的图片数据新增支持ImageDataSource类型,便于扩展

v1.0.1:2019-11-15

  • 简化集成步骤

v1.0.0:2019-11-7

  • ImageViewer初始版本

赞赏

如果您喜欢ImageViewer,或感觉ImageViewer帮助到了您,可以点右上角“Star”支持一下,您的支持就是我的动力,谢谢 : smiley:

您也可以扫描下面的二维码,请作者喝杯咖啡 :coffee:

关于我

Name: Jenly

Email: jenly1314#gmail.com / jenly1314#vip.qq.com

CSDN: jenly121

CNBlogs: jenly

GitHub: jenly1314

Gitee: jenly1314

加入QQ群: 20867961

The MIT License (MIT) Copyright (c) 2019 Jenly Yu Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

:sunrise: ImageViewer是一个图片查看器(类似微信查看图片效果),一般用来查看图片详情或查看大图时使用,支持多张查看。简单易用。 展开 收起
Android
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Android
1
https://gitee.com/jenly1314/ImageViewer.git
git@gitee.com:jenly1314/ImageViewer.git
jenly1314
ImageViewer
ImageViewer
master

搜索帮助