Android Picture Preview
一个用于大图预览的类库,可用于显示几十兆级别的图片,使图片在缩放过程中保持最佳清晰度。
单图预览
多图切换
ScaleType
Usage
Use Gradle:
dependencies {
compile 'me.kareluo.intensify:image:1.0.0'
}
Or Maven:
me.kareluo.intensify
image
1.0.0
pom
Sample
布局文件如下,width和height都要使用match_parent:
android:id="@+id/intensify_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:scaleType="fitAuto" />
代码中可以通过以下三种方式设置图片资源:
IntensifyImageView imageView = (IntensifyImageView)findViewById(R.id.intensify_image);
// 通过流设置
imageView.setImage(InputStream inputStream);
// 通过文件设置
imageView.setImage(File file);
// 通过文件路径设置
imageView.setImage(String path);
Blog
大图预览的主要原理是通过BitmapRegionDecoder对图片进行分块加载实现的,并在内存中维护不同精度,不同区域的Bitmap对象的加载与回收,详细内容可参考此篇博客:Android 原图预览
License
Copyright 2015 kareluo
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.