All Projects → albert-lii → Imageviewer

albert-lii / Imageviewer

🔮图片浏览器,支持图片手势缩放、拖拽等操作,`自定义View`的模式显示,自定义图片加载方式,更加灵活,易于扩展,同时也适用于RecyclerView、ListView的横向和纵向列表模式,最低支持版本为Android 3.0及以上...

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Imageviewer

android-page
android 分页列表数据加载引擎,主要封装了android分页列表数据加载的各个组件,如果你有一个需要分页加载的List列表,都可以使用此框架实现。
Stars: ✭ 15 (-95.87%)
Mutual labels:  listview, recyclerview, gridview
Countdowntask
⌛️A countdown library for Android.
Stars: ✭ 64 (-82.37%)
Mutual labels:  recyclerview, listview, gridview
Adapter
A quick adapter library for RecyclerView, GridView, ListView, ViewPager, Spinner
Stars: ✭ 376 (+3.58%)
Mutual labels:  recyclerview, listview, gridview
Placeholderview
This library provides advance views for lists and stacks. Some of the views are build on top of RecyclerView and others are written in their own. Annotations are compiled by annotation processor to generate bind classes. DOCS -->
Stars: ✭ 2,104 (+479.61%)
Mutual labels:  recyclerview, listview, gridview
Superadapter
[Deprecated]. 🚀 Adapter(BaseAdapter, RecyclerView.Adapter) wrapper for Android. 一个Adapter同时适用RecyclerView、ListView、GridView等。
Stars: ✭ 638 (+75.76%)
Mutual labels:  recyclerview, listview, gridview
Overscroll Decor
Android: iOS-like over-scrolling effect applicable over almost all scrollable Android views.
Stars: ✭ 2,671 (+635.81%)
Mutual labels:  recyclerview, listview, gridview
GenericRecyclerAdapter
Easiest way to use RecyclerView. Reduce boilerplate code! You don't need to write adapters for listing pages anymore!
Stars: ✭ 53 (-85.4%)
Mutual labels:  listview, recyclerview
recycler-adapter
RecyclerView-driven declarative UIs
Stars: ✭ 124 (-65.84%)
Mutual labels:  listview, recyclerview
Swipedelmenulayout
The most simple SwipeMenu in the history, 0 coupling, support any ViewGroup. Step integration swipe (delete) menu, high imitation QQ, iOS. ~史上最简单侧滑菜单,0耦合,支持任意ViewGroup。一步集成侧滑(删除)菜单,高仿QQ、IOS。~
Stars: ✭ 3,376 (+830.03%)
Mutual labels:  recyclerview, listview
react-native-nlist
原生Listview Native lListView react-native encapsulation Memory recovery reusing High performance
Stars: ✭ 60 (-83.47%)
Mutual labels:  listview, recyclerview
TwerkyListView
A beautifully animated recycler-list-view, that twerks the way African earthworms do in order to move
Stars: ✭ 19 (-94.77%)
Mutual labels:  listview, recyclerview
android-tableview-kotlin
Android's missing TableView component.
Stars: ✭ 40 (-88.98%)
Mutual labels:  recyclerview, gridview
recyclerview-list-drag-and-drop
No description or website provided.
Stars: ✭ 50 (-86.23%)
Mutual labels:  listview, recyclerview
GenericAdapter
⛳️ Easy to use android databinding ready recyclerview adapter
Stars: ✭ 26 (-92.84%)
Mutual labels:  listview, recyclerview
Recyclerlistview
High performance listview for React Native and web!
Stars: ✭ 4,033 (+1011.02%)
Mutual labels:  recyclerview, listview
InfiniteScroll
You can do a Endless scroll in ListView or RecyclerView with simple steps, with a listener for do request to your web service.
Stars: ✭ 28 (-92.29%)
Mutual labels:  listview, recyclerview
kandy
Sweet Android libraries written in Kotlin
Stars: ✭ 19 (-94.77%)
Mutual labels:  listview, recyclerview
Tableview
TableView is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells.
Stars: ✭ 2,928 (+706.61%)
Mutual labels:  recyclerview, gridview
adapster
Android library designed to enrich and make your RecyclerView adapters more SOLID
Stars: ✭ 17 (-95.32%)
Mutual labels:  listview, recyclerview
Flutter Layouts Exampls
Layout of the flutter example.such as Row,Comlun,listview,Just for learning.
Stars: ✭ 292 (-19.56%)
Mutual labels:  listview, gridview

ImageViewer

releasesvg apisvg license

关于

图片浏览器,支持图片手势缩放、拖拽等操作,自定义View的模式显示,自定义图片加载方式,可自定义索引UI、ProgressView,更加灵活,易于扩展,同时也适用于RecyclerView、ListView的横向和纵向列表模式,最低支持版本为Android 3.0及以上...

功能

  • 图片的基本缩放、滑动
  • 微信朋友圈图片放大预览
  • 微信朋友圈图片拖拽效果
  • 今日头条图片拖拽效果
  • 自定义图片加加载
  • 图片加载进度条
  • 可自定义图片索引与图片加载进度UI

传送门

推荐

  • AutoGridView 宫格控件,QQ空间九宫格、普通宫格模式、点击添加照片...

项目演示

简单示例 朋友圈

横向list 纵向list

自定义属性

属性名 描述
ivr_showIndex 是否显示图片位置
ivr_playEnterAnim 是否开启进场动画
ivr_playExitAnim 是否开启退场动画
ivr_duration 进场与退场动画的执行时间
ivr_draggable 是否允许图片拖拽
ivr_dragMode 拖拽模式(simple:今日头条效果

事件监听器

方法名 描述
setOnItemClickListener(OnItemClickListener listener) item 的单击事件
setOnItemLongListener(OnItemLongPressListener listener) item 的长按事件
setOnItemChangedListener(OnItemChangedListener listener) item 的切换事件
setOnDragStatusListener(OnDragStatusListener listener) 监听图片拖拽状态事件
setOnBrowseStatusListener(OnBrowseStatusListener listener) 监听图片浏览器状态事件

自定义UI

  • 自定义索引UI

框架中内置默认索引视图DefaultIndexUI,如要替换索引样式,可继承抽象类IndexUI,并在使用watch(...)方法前,调用下列方法加载自定义的indexUI

loadIndexUI(@NonNull IndexUI indexUI)
  • 自定义加载进度UI

框架中内置默认加载视图DefaultProgressUI,如要替换加载样式,可继承抽象类ProgressUI,并在使用watch(...)方法前,调用下列方法加载自定义的progressUI

loadProgressUI(@NonNull ProgressUI progressUI)

添加依赖

  • Gradle
   Step 1:

   allprojects {
       repositories {
           ...
           // 如果添加依赖时,报找不到项目时(则项目正在审核),可以添加此句maven地址,如果找到项目,可不必添加
           maven { url "https://dl.bintray.com/albertlii/android-maven/" }
       }
    }
    
    
   Step 2:
   
   dependencies {
      compile 'indi.liyi.view:image-viewer:3.0.1'
   }
  • Maven
   <dependency>
      <groupId>indi.liyi.view</groupId>
      <artifactId>image-viewer</artifactId>
      <version>3.0.1</version>
      <type>pom</type>
   </dependency>

使用方法

XML 中添加 ImageViewer

  <indi.liyi.viewer.ImageViewer
        android:id="@+id/imageViewer"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

代码中设置 ImageViewer

一共提供两种配置ImageViewer的方法:

  • 方法一:
imageViewer.overlayStatusBar(false) // ImageViewer 是否会占据 StatusBar 的空间
           .imageData(list) // 图片数据
           .bindViewGroup(gridview) // 目标 viewGroup,例如类似朋友圈中的九宫格控件
           .imageLoader(new PhotoLoader()) // 设置图片加载方式
           .playEnterAnim(true) // 是否开启进场动画,默认为true
           .playExitAnim(true) // 是否开启退场动画,默认为true
           .duration(true) // 设置进退场动画时间,默认300
           .showIndex(true) // 是否显示图片索引,默认为true
           .loadIndexUI(indexUI) // 自定义索引样式,内置默认样式
           .loadProgressUI(progressUI) // 自定义图片加载进度样式,内置默认样式
           .watch(position); // 开启浏览

此方法是用imageData()配合bindViewGroup()方法,来在内部构建自动构建item的信息模型ViewData,适用于目标ViewGroup类似于朋友圈九宫格控件这类场景,目标ViewGroup如果是ListView这种可重复利用item的控件,则不可用。

  • 方法二:
   imageViewer.overlayStatusBar(false) // ImageViewer 是否会占据 StatusBar 的空间
              .viewData(vdList) // 数据源
              .imageLoader(new PhotoLoader()) // 设置图片加载方式
              .playEnterAnim(true) // 是否开启进场动画,默认为true
              .playExitAnim(true) // 是否开启退场动画,默认为true
              .duration(true) // 设置进退场动画时间,默认300
              .showIndex(true) // 是否显示图片索引,默认为true
              .loadIndexUI(indexUI) // 自定义索引样式,内置默认样式
              .loadProgressUI(progressUI) // 自定义图片加载进度样式,内置默认样式
              .watch(position);

此方法直接使用viewData()设置框架所需要的数据源

Tip:关于点击系统返回键取消图片浏览

如果需要实现点击返回系统返回键关闭浏览,请在Activity中加入以下代码

  /**
     * 监听返回键
     *
     * @param keyCode
     * @param event
     * @return
     */
    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        boolean b = imageViewer.onKeyDown(keyCode, event);
        if (b) {
            return b;
        }
        return super.onKeyDown(keyCode, event);
    }

超巨图解决方案

  1. 因为可以自定义图片加载方法,在加载图片前可以先压缩图片

  2. 项目内部目前使用的图片缩放控件为PhotoView,可以将PhotoView用以下控件代替:

赞赏

如果你感觉 ImageViewer 帮助到了你,可以点右上角 "Star" 支持一下哦!😊

LICENSE

Copyright 2017 liyi

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].