Subsampling Scale Image View
===========================
A custom image view for Android, designed for photo galleries and displaying huge images (e.g. maps and building plans) without `OutOfMemoryError`s. Includes pinch to zoom, panning, rotation and animation support, and allows easy extension so you can add your own overlays and touch event detection.
The view optionally uses subsampling and tiles to support very large images - a low resolution base layer is loaded and as you zoom in, it is overlaid with smaller high resolution tiles for the visible area. This avoids holding too much data in memory. It's ideal for displaying large images while allowing you to zoom in to the high resolution details. You can disable tiling for smaller images and when displaying a bitmap object. There are some advantages and disadvantages to disabling tiling so to decide which is best, see [the wiki](https://github.com/davemorrissey/subsampling-scale-image-view/wiki/02.-Displaying-images).
#### Guides
* [Releases & downloads](https://github.com/davemorrissey/subsampling-scale-image-view/releases)
* [Installation and setup](https://github.com/davemorrissey/subsampling-scale-image-view/wiki/01.-Setup)
* [Image display notes & limitations](https://github.com/davemorrissey/subsampling-scale-image-view/wiki/02.-Displaying-images)
* [Using preview images](https://github.com/davemorrissey/subsampling-scale-image-view/wiki/03.-Preview-images)
* [Handling orientation changes](https://github.com/davemorrissey/subsampling-scale-image-view/wiki/05.-Orientation-changes)
* [Advanced configuration](https://github.com/davemorrissey/subsampling-scale-image-view/wiki/07.-Configuration)
* [Event handling](https://github.com/davemorrissey/subsampling-scale-image-view/wiki/09.-Events)
* [Animation](https://github.com/davemorrissey/subsampling-scale-image-view/wiki/08.-Animation)
* [Extension](https://github.com/davemorrissey/subsampling-scale-image-view/wiki/10.-Extension)
#### 2.x.x to 3.x.x migration
Version 3.x.x includes breaking changes. Please view the [migration guide](https://github.com/davemorrissey/subsampling-scale-image-view/wiki/X.--2.x.x-to-3.x.x-migration).
#### Download the sample app
[![Get it on Google Play](https://developer.android.com/images/brand/en_generic_rgb_wo_60.png)](https://play.google.com/store/apps/details?id=com.davemorrissey.labs.subscaleview.sample)
## Features
#### Image display
* Display images from assets, resources, the file system or bitmaps
* Automatically rotate images from the file system (e.g. the camera or gallery) according to EXIF
* Manually rotate images in 90° increments
* Display a region of the source image
* Use a preview image while large images load
* Swap images at runtime
* Use a custom bitmap decoder
*With tiling enabled:*
* Display huge images, larger than can be loaded into memory
* Show high resolution detail on zooming in
* Tested up to 20,000x20,000px, though larger images are slower
#### Gesture detection
* One finger pan
* Two finger pinch to zoom
* Quick scale (one finger zoom)
* Pan while zooming
* Seamless switch between pan and zoom
* Fling momentum after panning
* Double tap to zoom in and out
* Options to disable pan and/or zoom gestures
#### Animation
* Public methods for animating the scale and center
* Customisable duration and easing
* Optional uninterruptible animations
#### Overridable event detection
* Supports `OnClickListener` and `OnLongClickListener`
* Supports interception of events using `GestureDetector` and `OnTouchListener`
* Extend to add your own gestures
#### Easy integration
* Use within a `ViewPager` to create a photo gallery
* Easily restore scale, center and orientation after screen rotation
* Can be extended to add overlay graphics that move and scale with the image
* Handles view resizing and `wrap_content` layout
## Quick start
**1)** Add `com.davemorrissey.labs:subsampling-scale-image-view:3.6.0` as a dependency in your build.gradle file.
**2)** Add the view to your layout XML.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
**3a)** Now, in your fragment or activity, set the image resource, asset name or file path.
SubsamplingScaleImageView imageView = (SubsamplingScaleImageView)findViewById(id.imageView);
imageView.setImage(ImageSource.resource(R.drawable.monkey));
// ... or ...
imageView.setImage(ImageSource.asset("map.png"))
// ... or ...
imageView.setImage(ImageSource.uri("/sdcard/DCIM/DSCM00123.JPG"));
**3b)** Or, if you have a `Bitmap` object in memory, load it into the view. This is unsuitable for large images because it bypasses subsampling - you may get an `OutOfMemoryError`.
SubsamplingScaleImageView imageView = (SubsamplingScaleImageView)findViewById(id.imageView);
imageView.setImage(ImageSource.bitmap(bitmap));
## 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!
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Studio_subsampling-scale-image-view-master.zip (81个子文件)
subsampling-scale-image-view-master
settings.gradle 36B
library
project.properties 583B
src
com
davemorrissey
labs
subscaleview
SubsamplingScaleImageView.java 127KB
ImageViewState.java 1KB
decoder
ImageRegionDecoder.java 2KB
DecoderFactory.java 401B
CompatDecoderFactory.java 583B
ImageDecoder.java 1KB
SkiaImageRegionDecoder.java 4KB
SkiaImageDecoder.java 3KB
ImageSource.java 7KB
AndroidManifest.xml 320B
res
values
attrs.xml 1022B
.gitignore 6B
build.gradle 3KB
CONTRIBUTING.md 944B
LICENSE 10KB
gradle
wrapper
gradle-wrapper.properties 233B
gradle-wrapper.jar 49KB
README.md 5KB
sample
project.properties 601B
src
com
davemorrissey
labs
subscaleview
sample
extension
ExtensionPinFragment.java 2KB
views
PinView.java 2KB
CircleView.java 2KB
FreehandView.java 5KB
ExtensionCircleFragment.java 2KB
ExtensionFreehandFragment.java 2KB
ExtensionActivity.java 3KB
eventhandling
EventHandlingActivity.java 4KB
eventhandlingadvanced
AdvancedEventHandlingActivity.java 6KB
viewpager
ViewPagerFragment.java 2KB
ViewPagerActivity.java 2KB
imagedisplay
decoders
RapidImageRegionDecoder.java 2KB
RapidImageDecoder.java 1008B
ImageDisplayRotateFragment.java 2KB
ImageDisplayRegionFragment.java 2KB
ImageDisplayActivity.java 3KB
ImageDisplayLargeFragment.java 2KB
MainActivity.java 4KB
basicfeatures
BasicFeaturesActivity.java 4KB
configuration
ConfigurationActivity.java 6KB
animation
AnimationActivity.java 5KB
AndroidManifest.xml 1KB
res
drawable-hdpi
launcher.png 3KB
drawable-nodpi
buttonstate_standout.xml 554B
transparent.xml 177B
button_standout_inactive.xml 175B
pushpin_blue.png 8KB
button_transparent_pressed.xml 177B
button_standout_pressed.xml 175B
buttonstate_transparent.xml 586B
layout
extension_freehand_fragment.xml 3KB
imagedisplay_region_fragment.xml 3KB
animation_activity.xml 3KB
notes_activity.xml 2KB
extension_pin_fragment.xml 2KB
imagedisplay_rotate_fragment.xml 3KB
imagedisplay_large_fragment.xml 3KB
view_pager.xml 1KB
extension_activity.xml 373B
extension_circle_fragment.xml 3KB
view_pager_page.xml 398B
main.xml 7KB
drawable-xxhdpi
launcher.png 6KB
drawable-xhdpi
launcher.png 5KB
next.png 2KB
daffy.gif 4KB
reset.png 2KB
previous.png 2KB
rotate.png 2KB
play.png 2KB
values
colors.xml 162B
style.xml 452B
assets
ness.jpg 493KB
card.png 2.74MB
squirrel.jpg 1.08MB
libs
android-support-v4.jar 607KB
.gitignore 6B
build.gradle 1KB
.gitignore 296B
build.gradle 264B
共 81 条
- 1
资源评论
dashan618
- 粉丝: 9
- 资源: 34
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功