Giter Site home page Giter Site logo

hdimageview's Introduction

HDImageView

License Download

HD image view supporting pan and zoom, with very little memory usage and full featured image loading choices.

Requires Android SDK version 10 or higher.

Demo

Demo

Getting started

Step 1. Add the dependency

dependencies {
    compile 'xyz.zpayh:hdimageview:1.0.8'

    // 以下可以选用

    // if you use Glide 4.x , you can compile :(如果你正在使用Glide4.0或以上的版本,你可以添加下面的库)
    compile 'xyz.zpayh:hdimageview-glide:1.0.3'
    compile 'com.github.bumptech.glide:glide:4.0.0'

    // if you use Fresco 1.4.x , you can compile :(如果你正在使用Fresco1.4.0或以上的版本,你可以添加下面的库)
    compile 'com.facebook.fresco:imagepipeline:1.4.0'
    //... or
    compile 'com.facebook.fresco:fresco:1.4.0'
    
    compile 'xyz.zpayh:hdimageview-fresco:1.0.2'
}

Step 2. Add the view to your layout XML

<xyz.zpayh.hdimage.HDImageView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/image"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

Step 3. Set URI to HDImageView

    //...
    HDImageView mImageView = (HDImageView) findViewById(R.id.image);

    mImageView.setImageURI("res:///"+R.drawable.panorama);
    // Or 
    ImageSource imageSource = ImageSourceBuilder.newBuilder()
                .setUri(R.drawable.panorama)
                .build();
    mImageView.setImageSource(imageSource);

Supported URIs

HDImageView supports images in a variety of locations.

HDImageView does not accept relative URIs. All URIs must be absolute and must include the scheme.

These are the URI schemes accepted:

TYPE SCHEME FETCH METHOD USED
File on network http://, https:// HttpURLConnection
File on device file:// FileInputStream
Content provider content:// ContentResolver
Asset in app asset:/// AsseManager
Resource in app res:// as in res:///12345 Resources.openRawResource

Like this:

mHDImageView.setImageURI("res:///"+R.drawable.panorama);
mHDImageView.setImageURI("asset://beauty.jpg");
mHDImageView.setImageURI("file:///sdcard/DCIM/IMG_001.JPG");
mHDImageView.setImageURI("http://7xi8d6.com1.z0.glb.clouddn.com/2017-04-16-17934400_1738549946443321_2924146161843437568_n.jpg");
//....

In the use of the process, please remember to add the appropriate permissions

About

Powered by Subsampling Scale Image View

Copyright 2016 David Morrissey, and licensed under the Apache License, Version 2.0. No attribution is necessary but it's very much appreciated. Star this project if you like it!

hdimageview's People

Contributors

evilbt avatar

Watchers

James Cloos avatar szn0212 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.