HDImageView

介绍:

一个加载高清大图支持缩放的控件

运行效果:

使用说明:

Step 1.添加依赖

dependencies {
    compile 'xyz.zpayh:hdimageview:1.0.2'
}

Step 2.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. 为HDImageView设置URI

    //...
    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);

支持的URI

HDImageView supports images in a variety of locations.

HDImageView支持多种图片数据源。

HDImageView不支持相对地址的URI。所有URI都必须是绝对地址,并且包含scheme。

下面是支持的 URI scheme:

TYPESCHEMEFETCH METHOD USED
File on networkhttp://, https://HttpURLConnection
File on devicefile://FileInputStream
Content providercontent://ContentResolver
Asset in appasset://AsseManager
Resource in appres:// as in res:///12345Resources.openRawResource

例子:

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");
//....

最后记得添加相应的权限。

About

Powered by Subsampling Scale Image View

已下载
0