我是靠谱客的博主 洁净雪糕,最近开发中收集的这篇文章主要介绍android查看大图控件,HDImageView一个加载高清大图支持缩放的Android控件,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

HDImageView

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d417061636865253230322d677265656e2e73766768747470733a2f2f6170692e62696e747261792e636f6d2f7061636b616765732f736865726c6f636b2f6d6176656e2f6864696d616765766965772f696d616765732f646f776e6c6f61642e737667

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

Requires Android SDK version 14 or higher.

Demo

demo.gif

Getting started

Step 1. Add the dependency

dependencies {

implementation 'xyz.zpayh:hdimageview:3.0.1'

// 以下可以选用

// if you use Glide 4.x , you can compile :(如果你正在使用Glide 4.0或以上的版本,你可以添加下面的库)

implementation 'xyz.zpayh:hdimageview-glide:3.0.0'

implementation 'com.github.bumptech.glide:glide:4.9.0'

// if you use Fresco 1.4.x , you can compile :(如果你正在使用Fresco 2.0.0或以上的版本,你可以添加下面的库)

implementation 'com.facebook.fresco:fresco:2.0.0'

implementation 'xyz.zpayh:hdimageview-fresco:3.0.0'

}

Step 2. Add the view to your layout XML

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

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!

最后

以上就是洁净雪糕为你收集整理的android查看大图控件,HDImageView一个加载高清大图支持缩放的Android控件的全部内容,希望文章能够帮你解决android查看大图控件,HDImageView一个加载高清大图支持缩放的Android控件所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(58)

评论列表共有 0 条评论

立即
投稿
返回
顶部