Code Monkey home page Code Monkey logo

imagezoom's Introduction

在这里插入图片描述

亮点

一行代码实现网络图片、本地图片的缩放显示,支持长按保存到本地相册操作,适配6.0权限。

github项目地址地址

欢迎star、fork ,https://github.com/crazyandcoder/ImageZoom

效果演示及apk下载地址

下载地址及二维码

apk演示下载地址

预览效果

图集功能封装.gif

长按保存到本地相册,已经适配6.0权限

gradle 引用

dependencies {
  compile 'liji.library.dev:imagezoom:1.3.1'
}

maven使用

<dependency>
  <groupId>liji.library.dev</groupId>
  <artifactId>imagezoom</artifactId>
  <version>1.3.0</version>
  <type>pom</type>
</dependency>

使用方法

		//数据源
	final String[] urls = new String[] {
                "http://b.zol-img.com.cn/sjbizhi/images/2/320x510/1352891767829.jpg",
                "http://image.tianjimedia.com/uploadImages/2012/289/71X94T2PF22Z.jpg", 
                "http://b.zol-img.com.cn/sjbizhi/images/5/320x510/1372924333667.jpg",
                "http://image.tianjimedia.com/uploadImages/2014/069/XXQR67MY1RAR.jpg", 
        };

	//添加list数据	
	final List<String> list = new ArrayList<>();
        for (int i = 0; i < urls.length; i++) {
            list.add(urls[i]);
        }
        
        //打开图集
        Button btn = (Button) findViewById(R.id.btn);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ImageZoom.show(MainActivity.this, urls[1], list);
            }
        });

方法简介

1、public static void show(Context context, String url, List list)

	/**
     * 跳转到图片预览页面
     *
     * @param context
     * @param url     当前图片url
     * @param list    图片URL
     */

2、public static void show(Context context, int positon, List list)

	/**
     * 跳转到图片预览页面
     *
     * @param context
     * @param positon 图片显示的页码
     * @param list    图片URL
     */

3、public static void show(Context context, String url)

	/**
     * 跳转到图片预览页面
     *
     * @param context
     * @param url    图片URL
     */

4、public static void show(Context context, String url, int type)

	/**
     * 跳转到大图预览,只有一张图
     * @param context
     * @param url
     * @param type 包含加载本地图片的功能
     */

//type取值:
public class ImageUrlType {
    /**
     * 本地图片
     */
    public static final int LOCAL = 0;

    /**
     * drawable下面的图片
     */
    public static final int DRAWABLE=1;


}

//使用demo如加载drawable目录下面的图
 ImageZoom.show(this, "R.drawable.iclauncher", ImageUrlType.DRAWABLE);

更新说明

V1.3.1版本更新内容(2018.04.04)

  1. 解决图片保存到SD卡后存在两张相同的图片问题

imagezoom's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.