Subsampling Scale Image View
Displays an image subsampled as necessary to avoid loading too much image data into memory. After a pinch to zoom in, a set of image tiles subsampled at higher resolution are loaded and displayed over the base layer. During pinch and zoom, tiles off screen or higher/lower resolution than required are discarded from memory.
Tiles are no larger than the max supported bitmap size, so with large images tiling may be used even when zoomed out.
v prefixes - coordinates, translations and distances measured in screen (view) pixels s prefixes - coordinates, translations and distances measured in source image pixels (scaled)
Types
Link copied to clipboard
Builder class used to set additional options for a scale animation.
Link copied to clipboard
public class DefaultOnAnimationEventListener implements SubsamplingScaleImageView.OnAnimationEventListener
Default implementation of OnAnimationEventListener for extension.
Link copied to clipboard
Default implementation of OnImageEventListener for extension.
Link copied to clipboard
public class DefaultOnStateChangedListener implements SubsamplingScaleImageView.OnStateChangedListener
Default implementation of OnStateChangedListener.
Link copied to clipboard
An event listener for animations, allows events to be triggered when an animation completes, is aborted by another animation starting, or is aborted by a touch event.
Link copied to clipboard
An event listener, allowing subclasses and activities to be notified of significant events.
Link copied to clipboard
An event listener, allowing activities to be notified of pan and zoom events.
Properties
Link copied to clipboard
Quadratic ease in and out.
Link copied to clipboard
Quadratic ease out.
Link copied to clipboard
public int orientation
Link copied to clipboard
Display the image file in its native orientation.
Link copied to clipboard
Rotate the image 180 degrees.
Link copied to clipboard
Rotate the image 270 degrees clockwise.
Link copied to clipboard
Rotate the image 90 degrees clockwise.
Link copied to clipboard
Attempt to use EXIF information on the image to rotate it.
Link copied to clipboard
State change originated from animation.
Link copied to clipboard
State change originated from a double tap zoom anim.
Link copied to clipboard
State change originated from a fling momentum anim.
Link copied to clipboard
State change originated from touch gesture.
Link copied to clipboard
Allows the image to be panned until a corner reaches the center of the screen but no further.
Link copied to clipboard
Don't allow the image to be panned off screen.
Link copied to clipboard
Allows the image to be panned until it is just off screen, but no further.
Link copied to clipboard
Link copied to clipboard
Scale the image uniformly so that both dimensions of the image will be equal to or larger than the corresponding dimension of the view.
Link copied to clipboard
Scale the image so that both dimensions of the image will be equal to or less than the corresponding dimension of the view.
Link copied to clipboard
Scale the image so that both dimensions of the image will be equal to or less than the maxScale and equal to or larger than minScale.
Link copied to clipboard
Scale the image so that both dimensions of the image will be equal to or larger than the corresponding dimension of the view.
Link copied to clipboard
Link copied to clipboard
During zoom animation, move the point of the image that was tapped to the center of the screen.
Link copied to clipboard
Zoom in to and center the tapped point immediately without animating.
Link copied to clipboard
During zoom animation, keep the point of the image that was tapped in the same place, and scale the image around it.
Functions
Link copied to clipboard
Creates a panning animation builder, that when started will animate the image to place the given coordinates of the image in the center of the screen.
Link copied to clipboard
Creates a scale animation builder, that when started will animate a zoom in or out.
Link copied to clipboard
public SubsamplingScaleImageView.AnimationBuilder animateScaleAndCenter(float scale, PointF sCenter)
Creates a scale animation builder, that when started will animate a zoom in or out.
Link copied to clipboard
Returns the actual orientation of the image relative to the source file.
Link copied to clipboard
Returns the maximum allowed scale.
Link copied to clipboard
Returns the minimum allowed scale.
Link copied to clipboard
Returns the orientation setting.
Link copied to clipboard
Calculate how much further the image can be panned in each direction.
Link copied to clipboard
Get the current preferred configuration for decoding bitmaps.
Link copied to clipboard
Get source height, ignoring orientation.
Link copied to clipboard
Call to find whether the main image (base layer tiles where relevant) have been loaded.
Link copied to clipboard
Returns true if pan gesture detection is enabled.
Link copied to clipboard
Returns true if double tap &swipe to zoom is enabled.
Link copied to clipboard
Returns true if zoom gesture detection is enabled.
Link copied to clipboard
Handle touch events.
Link copied to clipboard
Fully zoom out and return the image to the middle of the screen.
Link copied to clipboard
Link copied to clipboard
Swap the default bitmap decoder implementation for one of your own.
Link copied to clipboard
public final void setBitmapDecoderFactory(DecoderFactory<? extends ImageDecoder> bitmapDecoderFactory)
Swap the default bitmap decoder implementation for one of your own.
Link copied to clipboard
bitmap 展示以X轴为准,填充满X轴
Link copied to clipboard
A density aware alternative to setDoubleTapZoomScale; this allows you to express the scale the image will zoom in to when double tapped in terms of the image pixel density.
Link copied to clipboard
Set the duration of the double tap zoom animation.
Link copied to clipboard
Set the scale the image will zoom in to when double tapped.
Link copied to clipboard
Set the type of zoom animation to be used for double taps.
Link copied to clipboard
Enable or disable eager loading of tiles that appear on screen during gestures or animations, while the gesture or animation is still in progress.
Link copied to clipboard
Provide an Executor to be used for loading images.
Link copied to clipboard
Set the image source from a bitmap, resource, asset, file or other URI.
Set the image source from a bitmap, resource, asset, file or other URI, providing a preview image to be displayed until the full size image is loaded.
Set the image source from a bitmap, resource, asset, file or other URI, starting with a given orientation setting, scale and center.
public final void setImage(ImageSource imageSource, ImageSource previewSource, ImageViewState state)
Set the image source from a bitmap, resource, asset, file or other URI, providing a preview image to be displayed until the full size image is loaded, starting with a given orientation setting, scale and center.
Link copied to clipboard
This is a screen density aware alternative to setMinScale; it allows you to express the minimum allowed scale in terms of the maximum pixel density.
Link copied to clipboard
Set the maximum scale allowed.
Link copied to clipboard
By default the View automatically calculates the optimal tile size.
Link copied to clipboard
This is a screen density aware alternative to setMaxScale; it allows you to express the maximum allowed scale in terms of the minimum pixel density.
Link copied to clipboard
Set the minimum scale type.
Link copied to clipboard
By default, image tiles are at least as high resolution as the screen.
Link copied to clipboard
Set the minimum scale allowed.
Link copied to clipboard
public void setOnImageEventListener(SubsamplingScaleImageView.OnImageEventListener onImageEventListener)
Add a listener allowing notification of load and error events.
Link copied to clipboard
Link copied to clipboard
public void setOnStateChangedListener(SubsamplingScaleImageView.OnStateChangedListener onStateChangedListener)
Add a listener for pan and zoom events.
Link copied to clipboard
Sets the image orientation.
Link copied to clipboard
Enable or disable pan gesture detection.
Link copied to clipboard
Set the pan limiting style.
Link copied to clipboard
Set a global preferred bitmap config shared by all view instances and applied to new instances initialised after the call is made.
Link copied to clipboard
Enable or disable double tap &swipe to zoom.
Link copied to clipboard
Swap the default region decoder implementation for one of your own.
Link copied to clipboard
public final void setRegionDecoderFactory(DecoderFactory<? extends ImageRegionDecoder> regionDecoderFactory)
Swap the default region decoder implementation for one of your own.
Link copied to clipboard
Externally change the scale and translation of the source image.
Link copied to clipboard
Set a solid color to render behind tiles, useful for displaying transparent PNGs.
Link copied to clipboard
Enable or disable zoom gesture detection.
Link copied to clipboard
Convert source coordinate to view coordinate.
Link copied to clipboard
Converts a rectangle within the view to the corresponding rectangle from the source file, taking into account the current scale, translation, orientation and clipped region.
Link copied to clipboard
Convert screen coordinate to source coordinate.
Link copied to clipboard
Find the area of the source file that is currently visible on screen, taking into account the current scale, translation, orientation and clipped region.