docs/javadoc/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.html
com.davemorrissey.labs.subscaleview
All Implemented Interfaces:Drawable.Callback, AccessibilityEventSource, KeyEvent.Callback
public classSubsamplingScaleImageViewextends[View](https://developer.android.com/reference/android/view/View.html?is-external=true "class or interface in android.view")
Displays an image subsampled as necessary to avoid loading too much image data into memory. After zooming in, a set of image tiles subsampled at higher resolution are loaded and displayed over the base layer. During pan 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 rotated and cropped source image pixels (scaled)
f prefixes - coordinates, translations and distances measured in original unrotated, uncropped source file pixels
Nested Classes | Modifier and Type | Class and Description |
| --- | --- |
| class | SubsamplingScaleImageView.AnimationBuilder
Builder class used to set additional options for a scale animation.
|
| static class | SubsamplingScaleImageView.DefaultOnAnimationEventListener
Default implementation of SubsamplingScaleImageView.OnAnimationEventListener for extension.
|
| static class | SubsamplingScaleImageView.DefaultOnImageEventListener
Default implementation of SubsamplingScaleImageView.OnImageEventListener for extension.
|
| static class | SubsamplingScaleImageView.DefaultOnStateChangedListener
Default implementation of SubsamplingScaleImageView.OnStateChangedListener.
|
| static interface | SubsamplingScaleImageView.OnAnimationEventListener
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.
|
| static interface | SubsamplingScaleImageView.OnImageEventListener
An event listener, allowing subclasses and activities to be notified of significant events.
|
| static interface | SubsamplingScaleImageView.OnStateChangedListener
An event listener, allowing activities to be notified of pan and zoom events.
|
-
View.AccessibilityDelegate, View.BaseSavedState, View.DragShadowBuilder, View.MeasureSpec, View.OnApplyWindowInsetsListener, View.OnAttachStateChangeListener, View.OnCapturedPointerListener, View.OnClickListener, View.OnContextClickListener, View.OnCreateContextMenuListener, View.OnDragListener, View.OnFocusChangeListener, View.OnGenericMotionListener, View.OnHoverListener, View.OnKeyListener, View.OnLayoutChangeListener, View.OnLongClickListener, View.OnScrollChangeListener, View.OnSystemUiVisibilityChangeListener, View.OnTouchListener
Fields | Modifier and Type | Field and Description |
| --- | --- |
| static int | EASE_IN_OUT_QUAD
Quadratic ease in and out.
|
| static int | EASE_OUT_QUAD
Quadratic ease out.
|
| static int | ORIENTATION_0
Display the image file in its native orientation.
|
| static int | ORIENTATION_180
Rotate the image 180 degrees.
|
| static int | ORIENTATION_270
Rotate the image 270 degrees clockwise.
|
| static int | ORIENTATION_90
Rotate the image 90 degrees clockwise.
|
| static int | ORIENTATION_USE_EXIF
Attempt to use EXIF information on the image to rotate it.
|
| static int | ORIGIN_ANIM
State change originated from animation.
|
| static int | ORIGIN_DOUBLE_TAP_ZOOM
State change originated from a double tap zoom anim.
|
| static int | ORIGIN_FLING
State change originated from a fling momentum anim.
|
| static int | ORIGIN_TOUCH
State change originated from touch gesture.
|
| static int | PAN_LIMIT_CENTER
Allows the image to be panned until a corner reaches the center of the screen but no further.
|
| static int | PAN_LIMIT_INSIDE
Don't allow the image to be panned off screen.
|
| static int | PAN_LIMIT_OUTSIDE
Allows the image to be panned until it is just off screen, but no further.
|
| static int | SCALE_TYPE_CENTER_CROP
Scale the image uniformly so that both dimensions of the image will be equal to or larger than the corresponding dimension of the view.
|
| static int | SCALE_TYPE_CENTER_INSIDE
Scale the image so that both dimensions of the image will be equal to or less than the corresponding dimension of the view.
|
| static int | SCALE_TYPE_CUSTOM
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.
|
| static int | SCALE_TYPE_START
Scale the image so that both dimensions of the image will be equal to or larger than the corresponding dimension of the view.
|
| static int | TILE_SIZE_AUTO |
| static int | ZOOM_FOCUS_CENTER
During zoom animation, move the point of the image that was tapped to the center of the screen.
|
| static int | ZOOM_FOCUS_CENTER_IMMEDIATE
Zoom in to and center the tapped point immediately without animating.
|
| static int | ZOOM_FOCUS_FIXED
During zoom animation, keep the point of the image that was tapped in the same place, and scale the image around it.
|
-
ACCESSIBILITY_LIVE_REGION_ASSERTIVE, ACCESSIBILITY_LIVE_REGION_NONE, ACCESSIBILITY_LIVE_REGION_POLITE, ALPHA, AUTOFILL_FLAG_INCLUDE_NOT_IMPORTANT_VIEWS, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR, AUTOFILL_HINT_CREDIT_CARD_NUMBER, AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE, AUTOFILL_HINT_EMAIL_ADDRESS, AUTOFILL_HINT_NAME, AUTOFILL_HINT_PASSWORD, AUTOFILL_HINT_PHONE, AUTOFILL_HINT_POSTAL_ADDRESS, AUTOFILL_HINT_POSTAL_CODE, AUTOFILL_HINT_USERNAME, AUTOFILL_TYPE_DATE, AUTOFILL_TYPE_LIST, AUTOFILL_TYPE_NONE, AUTOFILL_TYPE_TEXT, AUTOFILL_TYPE_TOGGLE, DRAG_FLAG_GLOBAL, DRAG_FLAG_GLOBAL_PERSISTABLE_URI_PERMISSION, DRAG_FLAG_GLOBAL_PREFIX_URI_PERMISSION, DRAG_FLAG_GLOBAL_URI_READ, DRAG_FLAG_GLOBAL_URI_WRITE, DRAG_FLAG_OPAQUE, DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FIND_VIEWS_WITH_CONTENT_DESCRIPTION, FIND_VIEWS_WITH_TEXT, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLE, FOCUSABLE_AUTO, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, IMPORTANT_FOR_ACCESSIBILITY_AUTO, IMPORTANT_FOR_ACCESSIBILITY_NO, IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS, IMPORTANT_FOR_ACCESSIBILITY_YES, IMPORTANT_FOR_AUTOFILL_AUTO, IMPORTANT_FOR_AUTOFILL_NO, IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS, IMPORTANT_FOR_AUTOFILL_YES, IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS, INVISIBLE, KEEP_SCREEN_ON, LAYER_TYPE_HARDWARE, LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE, LAYOUT_DIRECTION_LTR, LAYOUT_DIRECTION_RTL, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, NO_ID, NOT_FOCUSABLE, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCREEN_STATE_OFF, SCREEN_STATE_ON, SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_NONE, SCROLL_AXIS_VERTICAL, SCROLL_INDICATOR_BOTTOM, SCROLL_INDICATOR_END, SCROLL_INDICATOR_LEFT, SCROLL_INDICATOR_RIGHT, SCROLL_INDICATOR_START, SCROLL_INDICATOR_TOP, SCROLLBAR_POSITION_DEFAULT, SCROLLBAR_POSITION_LEFT, SCROLLBAR_POSITION_RIGHT, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, STATUS_BAR_HIDDEN, STATUS_BAR_VISIBLE, SYSTEM_UI_FLAG_FULLSCREEN, SYSTEM_UI_FLAG_HIDE_NAVIGATION, SYSTEM_UI_FLAG_IMMERSIVE, SYSTEM_UI_FLAG_IMMERSIVE_STICKY, SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_STABLE, SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR, SYSTEM_UI_FLAG_LIGHT_STATUS_BAR, SYSTEM_UI_FLAG_LOW_PROFILE, SYSTEM_UI_FLAG_VISIBLE, SYSTEM_UI_LAYOUT_FLAGS, TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_GRAVITY, TEXT_ALIGNMENT_INHERIT, TEXT_ALIGNMENT_TEXT_END, TEXT_ALIGNMENT_TEXT_START, TEXT_ALIGNMENT_VIEW_END, TEXT_ALIGNMENT_VIEW_START, TEXT_DIRECTION_ANY_RTL, TEXT_DIRECTION_FIRST_STRONG, TEXT_DIRECTION_FIRST_STRONG_LTR, TEXT_DIRECTION_FIRST_STRONG_RTL, TEXT_DIRECTION_INHERIT, TEXT_DIRECTION_LOCALE, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, TRANSLATION_X, TRANSLATION_Y, TRANSLATION_Z, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y, Z
Constructors | Constructor and Description |
| --- |
| SubsamplingScaleImageView(Context context) |
| SubsamplingScaleImageView(Context context, AttributeSet attr) |
All Methods Static Methods Instance Methods Concrete Methods | Modifier and Type | Method and Description |
| --- | --- |
| SubsamplingScaleImageView.AnimationBuilder | animateCenter(PointF sCenter)
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.
|
| SubsamplingScaleImageView.AnimationBuilder | animateScale(float scale)
Creates a scale animation builder, that when started will animate a zoom in or out.
|
| SubsamplingScaleImageView.AnimationBuilder | animateScaleAndCenter(float scale, PointF sCenter)
Creates a scale animation builder, that when started will animate a zoom in or out.
|
| int | getAppliedOrientation()
Returns the actual orientation of the image relative to the source file.
|
| PointF | getCenter()
Returns the source point at the center of the view.
|
| float | getMaxScale()
Returns the maximum allowed scale.
|
| float | getMinScale()
Returns the minimum allowed scale.
|
| int | getOrientation()
Returns the orientation setting.
|
| void | getPanRemaining(RectF vTarget)
Calculate how much further the image can be panned in each direction.
|
| static Bitmap.Config | getPreferredBitmapConfig()
Get the current preferred configuration for decoding bitmaps.
|
| float | getScale()
Returns the current scale value.
|
| int | getSHeight()
Get source height, ignoring orientation.
|
| ImageViewState | getState()
Get the current state of the view (scale, center, orientation) for restoration after rotate.
|
| int | getSWidth()
Get source width, ignoring orientation.
|
| boolean | hasImage()
Check if an image has been set.
|
| boolean | isImageLoaded()
Call to find whether the main image (base layer tiles where relevant) have been loaded.
|
| boolean | isPanEnabled()
Returns true if pan gesture detection is enabled.
|
| boolean | isQuickScaleEnabled()
Returns true if double tap & swipe to zoom is enabled.
|
| boolean | isReady()
Call to find whether the view is initialised, has dimensions, and will display an image on the next draw.
|
| boolean | isZoomEnabled()
Returns true if zoom gesture detection is enabled.
|
| protected void | onDraw(Canvas canvas)
Draw method should not be called until the view has dimensions so the first calls are used as triggers to calculate the scaling and tiling required.
|
| protected void | onImageLoaded()
Called once when the full size image or its base layer tiles have been loaded.
|
| protected void | onMeasure(int widthMeasureSpec, int heightMeasureSpec)
Measures the width and height of the view, preserving the aspect ratio of the image displayed if wrap_content is used.
|
| protected void | onReady()
Called once when the view is initialised, has dimensions, and will display an image on the next draw.
|
| protected void | onSizeChanged(int w, int h, int oldw, int oldh)
On resize, preserve center and scale.
|
| boolean | onTouchEvent(MotionEvent event)
Handle touch events.
|
| void | recycle()
Releases all resources the view is using and resets the state, nulling any fields that use significant memory.
|
| void | resetScaleAndCenter()
Fully zoom out and return the image to the middle of the screen.
|
| void | setBitmapDecoderClass(Class<? extends ImageDecoder> bitmapDecoderClass)
Swap the default bitmap decoder implementation for one of your own.
|
| void | setBitmapDecoderFactory(DecoderFactory<? extends ImageDecoder> bitmapDecoderFactory)
Swap the default bitmap decoder implementation for one of your own.
|
| void | setDebug(boolean debug)
Enables visual debugging, showing tile boundaries and sizes.
|
| void | setDoubleTapZoomDpi(int dpi)
A density aware alternative to setDoubleTapZoomScale(float); this allows you to express the scale the image will zoom in to when double tapped in terms of the image pixel density.
|
| void | setDoubleTapZoomDuration(int durationMs)
Set the duration of the double tap zoom animation.
|
| void | setDoubleTapZoomScale(float doubleTapZoomScale)
Set the scale the image will zoom in to when double tapped.
|
| void | setDoubleTapZoomStyle(int doubleTapZoomStyle)
Set the type of zoom animation to be used for double taps.
|
| void | setEagerLoadingEnabled(boolean eagerLoadingEnabled)
Enable or disable eager loading of tiles that appear on screen during gestures or animations, while the gesture or animation is still in progress.
|
| void | setExecutor(Executor executor)
Provide an Executor to be used for loading images.
|
| void | setImage(ImageSource imageSource)
Set the image source from a bitmap, resource, asset, file or other URI.
|
| void | setImage(ImageSource imageSource, ImageSource previewSource)
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.
|
| 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.
|
| void | setImage(ImageSource imageSource, ImageViewState state)
Set the image source from a bitmap, resource, asset, file or other URI, starting with a given orientation setting, scale and center.
|
| void | setMaximumDpi(int dpi)
This is a screen density aware alternative to setMinScale(float); it allows you to express the minimum allowed scale in terms of the maximum pixel density.
|
| void | setMaxScale(float maxScale)
Set the maximum scale allowed.
|
| void | setMaxTileSize(int maxPixels)
By default the View automatically calculates the optimal tile size.
|
| void | setMaxTileSize(int maxPixelsX, int maxPixelsY)
By default the View automatically calculates the optimal tile size.
|
| void | setMinimumDpi(int dpi)
This is a screen density aware alternative to setMaxScale(float); it allows you to express the maximum allowed scale in terms of the minimum pixel density.
|
| void | setMinimumScaleType(int scaleType)
Set the minimum scale type.
|
| void | setMinimumTileDpi(int minimumTileDpi)
By default, image tiles are at least as high resolution as the screen.
|
| void | setMinScale(float minScale)
Set the minimum scale allowed.
|
| void | setOnImageEventListener(SubsamplingScaleImageView.OnImageEventListener onImageEventListener)
Add a listener allowing notification of load and error events.
|
| void | setOnLongClickListener(View.OnLongClickListener onLongClickListener) |
| void | setOnStateChangedListener(SubsamplingScaleImageView.OnStateChangedListener onStateChangedListener)
Add a listener for pan and zoom events.
|
| void | setOrientation(int orientation)
Sets the image orientation.
|
| void | setPanEnabled(boolean panEnabled)
Enable or disable pan gesture detection.
|
| void | setPanLimit(int panLimit)
Set the pan limiting style.
|
| static void | setPreferredBitmapConfig(Bitmap.Config preferredBitmapConfig)
Set a global preferred bitmap config shared by all view instances and applied to new instances initialised after the call is made.
|
| void | setQuickScaleEnabled(boolean quickScaleEnabled)
Enable or disable double tap & swipe to zoom.
|
| void | setRegionDecoderClass(Class<? extends ImageRegionDecoder> regionDecoderClass)
Swap the default region decoder implementation for one of your own.
|
| void | setRegionDecoderFactory(DecoderFactory<? extends ImageRegionDecoder> regionDecoderFactory)
Swap the default region decoder implementation for one of your own.
|
| void | setScaleAndCenter(float scale, PointF sCenter)
Externally change the scale and translation of the source image.
|
| void | setTileBackgroundColor(int tileBgColor)
Set a solid color to render behind tiles, useful for displaying transparent PNGs.
|
| void | setZoomEnabled(boolean zoomEnabled)
Enable or disable zoom gesture detection.
|
| PointF | sourceToViewCoord(float sx, float sy)
Convert source coordinate to view coordinate.
|
| PointF | sourceToViewCoord(float sx, float sy, PointF vTarget)
Convert source coordinate to view coordinate.
|
| PointF | sourceToViewCoord(PointF sxy)
Convert source coordinate to view coordinate.
|
| PointF | sourceToViewCoord(PointF sxy, PointF vTarget)
Convert source coordinate to view coordinate.
|
| void | viewToFileRect(Rect vRect, Rect fRect)
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.
|
| PointF | viewToSourceCoord(float vx, float vy)
Convert screen coordinate to source coordinate.
|
| PointF | viewToSourceCoord(float vx, float vy, PointF sTarget)
Convert screen coordinate to source coordinate.
|
| PointF | viewToSourceCoord(PointF vxy)
Convert screen coordinate to source coordinate.
|
| PointF | viewToSourceCoord(PointF vxy, PointF sTarget)
Convert screen coordinate to source coordinate.
|
| void | visibleFileRect(Rect fRect)
Find the area of the source file that is currently visible on screen, taking into account the current scale, translation, orientation and clipped region.
|
-
addChildrenForAccessibility, addExtraDataToAccessibilityNodeInfo, addFocusables, addFocusables, addKeyboardNavigationClusters, addOnAttachStateChangeListener, addOnLayoutChangeListener, addTouchables, animate, announceForAccessibility, autofill, autofill, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelDragAndDrop, cancelLongPress, cancelPendingInputEvents, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, checkInputConnectionProxy, clearAnimation, clearFocus, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeSystemWindowInsets, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchApplyWindowInsets, dispatchCapturedPointerEvent, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchGenericFocusedEvent, dispatchGenericMotionEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPointerCaptureChanged, dispatchPopulateAccessibilityEvent, dispatchProvideAutofillStructure, dispatchProvideStructure, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, draw, drawableHotspotChanged, drawableStateChanged, findFocus, findViewById, findViewsWithText, findViewWithTag, fitSystemWindows, focusSearch, forceHasOverlappingRendering, forceLayout, generateViewId, getAccessibilityClassName, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAlpha, getAnimation, getApplicationWindowToken, getAutofillHints, getAutofillId, getAutofillType, getAutofillValue, getBackground, getBackgroundTintList, getBackgroundTintMode, getBaseline, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentDescription, getContext, getContextMenuInfo, getDefaultFocusHighlightEnabled, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusable, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getImportantForAccessibility, getImportantForAutofill, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineProvider, getOverlay, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getPointerIcon, getResources, getRevealOnFocusHint, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTooltipText, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowId, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasExplicitFocusable, hasFocus, hasFocusable, hasNestedScrollingParent, hasOnClickListeners, hasOverlappingRendering, hasPointerCapture, hasTransientState, hasWindowFocus, inflate, invalidate, invalidate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityFocused, isActivated, isAttachedToWindow, isClickable, isContextClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isImportantForAutofill, isInEditMode, isInLayout, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingOffsetRequired, isPaddingRelative, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, jumpDrawablesToCurrentState, keyboardNavigationClusterSearch, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAnimationEnd, onAnimationStart, onApplyWindowInsets, onAttachedToWindow, onCancelPendingInputEvents, onCapturedPointerEvent, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateDrawableState, onCreateInputConnection, onDetachedFromWindow, onDisplayHint, onDragEvent, onDrawForeground, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onLayout, onOverScrolled, onPointerCaptureChange, onPopulateAccessibilityEvent, onProvideAutofillStructure, onProvideAutofillVirtualStructure, onProvideStructure, onProvideVirtualStructure, onResolvePointerIcon, onRestoreInstanceState, onRtlPropertiesChanged, onSaveInstanceState, onScreenStateChanged, onScrollChanged, onSetAlpha, onStartTemporaryDetach, onTrackballEvent, onVisibilityAggregated, onVisibilityChanged, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performAccessibilityAction, performClick, performContextClick, performContextClick, performHapticFeedback, performHapticFeedback, performLongClick, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, releasePointerCapture, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestPointerCapture, requestRectangleOnScreen, requestRectangleOnScreen, requestUnbufferedDispatch, resolveSize, resolveSizeAndState, restoreDefaultFocus, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityLiveRegion, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAlpha, setAnimation, setAutofillHints, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentDescription, setContextClickable, setDefaultFocusHighlightEnabled, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusable, setFocusableInTouchMode, setFocusedByDefault, setForeground, setForegroundGravity, setForegroundTintList, setForegroundTintMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setImportantForAutofill, setKeepScreenOn, setKeyboardNavigationCluster, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnCapturedPointerListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineProvider, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPointerIcon, setPressed, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setStateListAnimator, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTooltipText, setTop, setTouchDelegate, setTransitionName, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, showContextMenu, showContextMenu, startActionMode, startActionMode, startAnimation, startDrag, startDragAndDrop, startNestedScroll, stopNestedScroll, toString, unscheduleDrawable, unscheduleDrawable, updateDragShadow, verifyDrawable, willNotCacheDrawing, willNotDraw
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
public static final int ORIENTATION_USE_EXIF
Attempt to use EXIF information on the image to rotate it. Works for external files only. See Also:Constant Field Values
-
public static final int ORIENTATION_0
Display the image file in its native orientation. See Also:Constant Field Values
-
public static final int ORIENTATION_90
Rotate the image 90 degrees clockwise. See Also:Constant Field Values
-
public static final int ORIENTATION_180
Rotate the image 180 degrees. See Also:Constant Field Values
-
public static final int ORIENTATION_270
Rotate the image 270 degrees clockwise. See Also:Constant Field Values
-
public static final int ZOOM_FOCUS_FIXED
During zoom animation, keep the point of the image that was tapped in the same place, and scale the image around it. See Also:Constant Field Values
-
public static final int ZOOM_FOCUS_CENTER
During zoom animation, move the point of the image that was tapped to the center of the screen. See Also:Constant Field Values
-
public static final int ZOOM_FOCUS_CENTER_IMMEDIATE
Zoom in to and center the tapped point immediately without animating. See Also:Constant Field Values
-
public static final int EASE_OUT_QUAD
Quadratic ease out. Not recommended for scale animation, but good for panning. See Also:Constant Field Values
-
public static final int EASE_IN_OUT_QUAD
Quadratic ease in and out. See Also:Constant Field Values
-
public static final int PAN_LIMIT_INSIDE
Don't allow the image to be panned off screen. As much of the image as possible is always displayed, centered in the view when it is smaller. This is the best option for galleries. See Also:Constant Field Values
-
public static final int PAN_LIMIT_OUTSIDE
Allows the image to be panned until it is just off screen, but no further. The edge of the image will stop when it is flush with the screen edge. See Also:Constant Field Values
-
public static final int PAN_LIMIT_CENTER
Allows the image to be panned until a corner reaches the center of the screen but no further. Useful when you want to pan any spot on the image to the exact center of the screen. See Also:Constant Field Values
-
public static final int SCALE_TYPE_CENTER_INSIDE
Scale the image so that both dimensions of the image will be equal to or less than the corresponding dimension of the view. The image is then centered in the view. This is the default behaviour and best for galleries. See Also:Constant Field Values
-
public static final int SCALE_TYPE_CENTER_CROP
Scale the image uniformly so that both dimensions of the image will be equal to or larger than the corresponding dimension of the view. The image is then centered in the view. See Also:Constant Field Values
-
public static final int SCALE_TYPE_CUSTOM
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. The image is then centered in the view. See Also:Constant Field Values
-
public static final int SCALE_TYPE_START
Scale the image so that both dimensions of the image will be equal to or larger than the corresponding dimension of the view. The top left is shown. See Also:Constant Field Values
-
public static final int ORIGIN_ANIM
State change originated from animation. See Also:Constant Field Values
-
public static final int ORIGIN_TOUCH
State change originated from touch gesture. See Also:Constant Field Values
-
public static final int ORIGIN_FLING
State change originated from a fling momentum anim. See Also:Constant Field Values
-
public static final int ORIGIN_DOUBLE_TAP_ZOOM
State change originated from a double tap zoom anim. See Also:Constant Field Values
-
public static final int TILE_SIZE_AUTO
See Also:Constant Field Values
-
public SubsamplingScaleImageView([Context](https://developer.android.com/reference/android/content/Context.html?is-external=true "class or interface in android.content")context,[AttributeSet](https://developer.android.com/reference/android/util/AttributeSet.html?is-external=true "class or interface in android.util")attr)
-
public SubsamplingScaleImageView([Context](https://developer.android.com/reference/android/content/Context.html?is-external=true "class or interface in android.content")context)
-
public static[Bitmap.Config](https://developer.android.com/reference/android/graphics/Bitmap.Config.html?is-external=true "class or interface in android.graphics")getPreferredBitmapConfig()
Get the current preferred configuration for decoding bitmaps. ImageDecoder and ImageRegionDecoder instances can read this and use it when decoding images.
Returns:the preferred bitmap configuration, or null if none has been set.
-
public static void setPreferredBitmapConfig([Bitmap.Config](https://developer.android.com/reference/android/graphics/Bitmap.Config.html?is-external=true "class or interface in android.graphics")preferredBitmapConfig)
Set a global preferred bitmap config shared by all view instances and applied to new instances initialised after the call is made. This is a hint only; the bundled ImageDecoder and ImageRegionDecoder classes all respect this (except when they were constructed with an instance-specific config) but custom decoder classes will not.
Parameters:preferredBitmapConfig - the bitmap configuration to be used by future instances of the view. Pass null to restore the default.
-
public final void setOrientation(int orientation)
Sets the image orientation. It's best to call this before setting the image file or asset, because it may waste loading of tiles. However, this can be freely called at any time.
Parameters:orientation - orientation to be set. See ORIENTATION_ static fields for valid values.
-
public final void setImage([@NonNull](https://developer.android.com/reference/android/support.annotation.NonNull.html?is-external=true "class or interface in android")[ImageSource](../../../../com/davemorrissey/labs/subscaleview/ImageSource.html "class in com.davemorrissey.labs.subscaleview")imageSource)
Set the image source from a bitmap, resource, asset, file or other URI.
Parameters:imageSource - Image source.
-
public final void setImage([@NonNull](https://developer.android.com/reference/android/support.annotation.NonNull.html?is-external=true "class or interface in android")[ImageSource](../../../../com/davemorrissey/labs/subscaleview/ImageSource.html "class in com.davemorrissey.labs.subscaleview")imageSource,[ImageViewState](../../../../com/davemorrissey/labs/subscaleview/ImageViewState.html "class in com.davemorrissey.labs.subscaleview")state)
Set the image source from a bitmap, resource, asset, file or other URI, starting with a given orientation setting, scale and center. This is the best method to use when you want scale and center to be restored after screen orientation change; it avoids any redundant loading of tiles in the wrong orientation.
Parameters:imageSource - Image source.state - State to be restored. Nullable.
-
public final void setImage([@NonNull](https://developer.android.com/reference/android/support.annotation.NonNull.html?is-external=true "class or interface in android")[ImageSource](../../../../com/davemorrissey/labs/subscaleview/ImageSource.html "class in com.davemorrissey.labs.subscaleview")imageSource,[ImageSource](../../../../com/davemorrissey/labs/subscaleview/ImageSource.html "class in com.davemorrissey.labs.subscaleview")previewSource)
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. You must declare the dimensions of the full size image by calling ImageSource.dimensions(int, int) on the imageSource object. The preview source will be ignored if you don't provide dimensions, and if you provide a bitmap for the full size image.
Parameters:imageSource - Image source. Dimensions must be declared.previewSource - Optional source for a preview image to be displayed and allow interaction while the full size image loads.
-
public final void setImage([@NonNull](https://developer.android.com/reference/android/support.annotation.NonNull.html?is-external=true "class or interface in android")[ImageSource](../../../../com/davemorrissey/labs/subscaleview/ImageSource.html "class in com.davemorrissey.labs.subscaleview")imageSource,[ImageSource](../../../../com/davemorrissey/labs/subscaleview/ImageSource.html "class in com.davemorrissey.labs.subscaleview")previewSource,[ImageViewState](../../../../com/davemorrissey/labs/subscaleview/ImageViewState.html "class in com.davemorrissey.labs.subscaleview")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. This is the best method to use when you want scale and center to be restored after screen orientation change; it avoids any redundant loading of tiles in the wrong orientation. You must declare the dimensions of the full size image by calling ImageSource.dimensions(int, int) on the imageSource object. The preview source will be ignored if you don't provide dimensions, and if you provide a bitmap for the full size image.
Parameters:imageSource - Image source. Dimensions must be declared.previewSource - Optional source for a preview image to be displayed and allow interaction while the full size image loads.state - State to be restored. Nullable.
-
protected void onSizeChanged(int w,
int h,
int oldw,
int oldh)
On resize, preserve center and scale. Various behaviours are possible, override this method to use another.
Overrides:onSizeChanged in class View
-
protected void onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
Measures the width and height of the view, preserving the aspect ratio of the image displayed if wrap_content is used. The image will scale within this box, not resizing the view as it is zoomed.
Overrides:onMeasure in class View
-
public boolean onTouchEvent([@NonNull](https://developer.android.com/reference/android/support.annotation.NonNull.html?is-external=true "class or interface in android")[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent.html?is-external=true "class or interface in android.view")event)
Handle touch events. One finger pans, and two finger pinch and zoom plus panning.
Overrides:onTouchEvent in class View
-
protected void onDraw([Canvas](https://developer.android.com/reference/android/graphics/Canvas.html?is-external=true "class or interface in android.graphics")canvas)
Draw method should not be called until the view has dimensions so the first calls are used as triggers to calculate the scaling and tiling required. Once the view is setup, tiles are displayed as they are loaded.
Overrides:onDraw in class View
-
public void setMaxTileSize(int maxPixels)
By default the View automatically calculates the optimal tile size. Set this to override this, and force an upper limit to the dimensions of the generated tiles. Passing TILE_SIZE_AUTO will re-enable the default behaviour.
Parameters:maxPixels - Maximum tile size X and Y in pixels.
-
public void setMaxTileSize(int maxPixelsX,
int maxPixelsY)
By default the View automatically calculates the optimal tile size. Set this to override this, and force an upper limit to the dimensions of the generated tiles. Passing TILE_SIZE_AUTO will re-enable the default behaviour.
Parameters:maxPixelsX - Maximum tile width.maxPixelsY - Maximum tile height.
-
public void recycle()
Releases all resources the view is using and resets the state, nulling any fields that use significant memory. After you have called this method, the view can be re-used by setting a new image. Settings are remembered but state (scale and center) is forgotten. You can restore these yourself if required.
-
public void viewToFileRect([Rect](https://developer.android.com/reference/android/graphics/Rect.html?is-external=true "class or interface in android.graphics")vRect,[Rect](https://developer.android.com/reference/android/graphics/Rect.html?is-external=true "class or interface in android.graphics")fRect)
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. This can be used to decode a bitmap from the source file. This method will only work when the image has fully initialised, after isReady() returns true. It is not guaranteed to work with preloaded bitmaps. The result is written to the fRect argument. Re-use a single instance for efficiency.
Parameters:vRect - rectangle representing the view area to interpret.fRect - rectangle instance to which the result will be written. Re-use for efficiency.
-
public void visibleFileRect([Rect](https://developer.android.com/reference/android/graphics/Rect.html?is-external=true "class or interface in android.graphics")fRect)
Find the area of the source file that is currently visible on screen, taking into account the current scale, translation, orientation and clipped region. This is a convenience method; see viewToFileRect(Rect, Rect).
Parameters:fRect - rectangle instance to which the result will be written. Re-use for efficiency.
-
[@Nullable](https://developer.android.com/reference/android/support.annotation.Nullable.html?is-external=true "class or interface in android")public final[PointF](https://developer.android.com/reference/android/graphics/PointF.html?is-external=true "class or interface in android.graphics")viewToSourceCoord([PointF](https://developer.android.com/reference/android/graphics/PointF.html?is-external=true "class or interface in android.graphics")vxy)
Convert screen coordinate to source coordinate.
Parameters:vxy - view X/Y coordinate.Returns:a coordinate representing the corresponding source coordinate.
-
[@Nullable](https://developer.android.com/reference/android/support.annotation.Nullable.html?is-external=true "class or interface in android")public final[PointF](https://developer.android.com/reference/android/graphics/PointF.html?is-external=true "class or interface in android.graphics")viewToSourceCoord(float vx,
float vy)
Convert screen coordinate to source coordinate.
Parameters:vx - view X coordinate.vy - view Y coordinate.Returns:a coordinate representing the corresponding source coordinate.
-
[@Nullable](https://developer.android.com/reference/android/support.annotation.Nullable.html?is-external=true "class or interface in android")public final[PointF](https://developer.android.com/reference/android/graphics/PointF.html?is-external=true "class or interface in android.graphics")viewToSourceCoord([PointF](https://developer.android.com/reference/android/graphics/PointF.html?is-external=true "class or interface in android.graphics")vxy,[@NonNull](https://developer.android.com/reference/android/support.annotation.NonNull.html?is-external=true "class or interface in android")[PointF](https://developer.android.com/reference/android/graphics/PointF.html?is-external=true "class or interface in android.graphics")sTarget)
Convert screen coordinate to source coordinate.
Parameters:vxy - view coordinates to convert.sTarget - target object for result. The same instance is also returned.Returns:source coordinates. This is the same instance passed to the sTarget param.
-
[@Nullable](https://developer.android.com/reference/android/support.annotation.Nullable.html?is-external=true "class or interface in android")public final[PointF](https://developer.android.com/reference/android/graphics/PointF.html?is-external=true "class or interface in android.graphics")viewToSourceCoord(float vx,
float vy,[@NonNull](https://developer.android.com/reference/android/support.annotation.NonNull.html?is-external=true "class or interface in android")[PointF](https://developer.android.com/reference/android/graphics/PointF.html?is-external=true "class or interface in android.graphics")sTarget)
Convert screen coordinate to source coordinate.
Parameters:vx - view X coordinate.vy - view Y coordinate.sTarget - target object for result. The same instance is also returned.Returns:source coordinates. This is the same instance passed to the sTarget param.
-
[@Nullable](https://developer.android.com/reference/android/support.annotation.Nullable.html?is-external=true "class or interface in android")public final[PointF](https://developer.android.com/reference/android/graphics/PointF.html?is-external=true "class or interface in android.graphics")sourceToViewCoord([PointF](https://developer.android.com/reference/android/graphics/PointF.html?is-external=true "class or interface in android.graphics")sxy)
Convert source coordinate to view coordinate.
Parameters:sxy - source coordinates to convert.Returns:view coordinates.
-
[@Nullable](https://developer.android.com/reference/android/support.annotation.Nullable.html?is-external=true "class or interface in android")public final[PointF](https://developer.android.com/reference/android/graphics/PointF.html?is-external=true "class or interface in android.graphics")sourceToViewCoord(float sx,
float sy)
Convert source coordinate to view coordinate.
Parameters:sx - source X coordinate.sy - source Y coordinate.Returns:view coordinates.
-
[@Nullable](https://developer.android.com/reference/android/support.annotation.Nullable.html?is-external=true "class or interface in android")public final[PointF](https://developer.android.com/reference/android/graphics/PointF.html?is-external=true "class or interface in android.graphics")sourceToViewCoord([PointF](https://developer.android.com/reference/android/graphics/PointF.html?is-external=true "class or interface in android.graphics")sxy,[@NonNull](https://developer.android.com/reference/android/support.annotation.NonNull.html?is-external=true "class or interface in android")[PointF](https://developer.android.com/reference/android/graphics/PointF.html?is-external=true "class or interface in android.graphics")vTarget)
Convert source coordinate to view coordinate.
Parameters:sxy - source coordinates to convert.vTarget - target object for result. The same instance is also returned.Returns:view coordinates. This is the same instance passed to the vTarget param.
-
[@Nullable](https://developer.android.com/reference/android/support.annotation.Nullable.html?is-external=true "class or interface in android")public final[PointF](https://developer.android.com/reference/android/graphics/PointF.html?is-external=true "class or interface in android.graphics")sourceToViewCoord(float sx,
float sy,[@NonNull](https://developer.android.com/reference/android/support.annotation.NonNull.html?is-external=true "class or interface in android")[PointF](https://developer.android.com/reference/android/graphics/PointF.html?is-external=true "class or interface in android.graphics")vTarget)
Convert source coordinate to view coordinate.
Parameters:sx - source X coordinate.sy - source Y coordinate.vTarget - target object for result. The same instance is also returned.Returns:view coordinates. This is the same instance passed to the vTarget param.
-
public final void setRegionDecoderClass([@NonNull](https://developer.android.com/reference/android/support.annotation.NonNull.html?is-external=true "class or interface in android")[Class](https://developer.android.com/reference/java/lang/Class.html?is-external=true "class or interface in java.lang")<? extends[ImageRegionDecoder](../../../../com/davemorrissey/labs/subscaleview/decoder/ImageRegionDecoder.html "interface in com.davemorrissey.labs.subscaleview.decoder")> regionDecoderClass)
Swap the default region decoder implementation for one of your own. You must do this before setting the image file or asset, and you cannot use a custom decoder when using layout XML to set an asset name. Your class must have a public default constructor.
Parameters:regionDecoderClass - The ImageRegionDecoder implementation to use.
-
public final void setRegionDecoderFactory([@NonNull](https://developer.android.com/reference/android/support.annotation.NonNull.html?is-external=true "class or interface in android")[DecoderFactory](../../../../com/davemorrissey/labs/subscaleview/decoder/DecoderFactory.html "interface in com.davemorrissey.labs.subscaleview.decoder")<? extends[ImageRegionDecoder](../../../../com/davemorrissey/labs/subscaleview/decoder/ImageRegionDecoder.html "interface in com.davemorrissey.labs.subscaleview.decoder")> regionDecoderFactory)
Swap the default region decoder implementation for one of your own. You must do this before setting the image file or asset, and you cannot use a custom decoder when using layout XML to set an asset name.
Parameters:regionDecoderFactory - The DecoderFactory implementation that produces ImageRegionDecoder instances.
-
public final void setBitmapDecoderClass([@NonNull](https://developer.android.com/reference/android/support.annotation.NonNull.html?is-external=true "class or interface in android")[Class](https://developer.android.com/reference/java/lang/Class.html?is-external=true "class or interface in java.lang")<? extends[ImageDecoder](../../../../com/davemorrissey/labs/subscaleview/decoder/ImageDecoder.html "interface in com.davemorrissey.labs.subscaleview.decoder")> bitmapDecoderClass)
Swap the default bitmap decoder implementation for one of your own. You must do this before setting the image file or asset, and you cannot use a custom decoder when using layout XML to set an asset name. Your class must have a public default constructor.
Parameters:bitmapDecoderClass - The ImageDecoder implementation to use.
-
public final void setBitmapDecoderFactory([@NonNull](https://developer.android.com/reference/android/support.annotation.NonNull.html?is-external=true "class or interface in android")[DecoderFactory](../../../../com/davemorrissey/labs/subscaleview/decoder/DecoderFactory.html "interface in com.davemorrissey.labs.subscaleview.decoder")<? extends[ImageDecoder](../../../../com/davemorrissey/labs/subscaleview/decoder/ImageDecoder.html "interface in com.davemorrissey.labs.subscaleview.decoder")> bitmapDecoderFactory)
Swap the default bitmap decoder implementation for one of your own. You must do this before setting the image file or asset, and you cannot use a custom decoder when using layout XML to set an asset name.
Parameters:bitmapDecoderFactory - The DecoderFactory implementation that produces ImageDecoder instances.
-
public final void getPanRemaining([RectF](https://developer.android.com/reference/android/graphics/RectF.html?is-external=true "class or interface in android.graphics")vTarget)
Calculate how much further the image can be panned in each direction. The results are set on the supplied RectF and expressed as screen pixels. For example, if the image cannot be panned any further towards the left, the value of RectF.left will be set to 0.
Parameters:vTarget - target object for results. Re-use for efficiency.
-
public final void setPanLimit(int panLimit)
Set the pan limiting style. See static fields. Normally PAN_LIMIT_INSIDE is best, for image galleries.
Parameters:panLimit - a pan limit constant. See static fields.
-
public final void setMinimumScaleType(int scaleType)
Set the minimum scale type. See static fields. Normally SCALE_TYPE_CENTER_INSIDE is best, for image galleries.
Parameters:scaleType - a scale type constant. See static fields.
-
public final void setMaxScale(float maxScale)
Set the maximum scale allowed. A value of 1 means 1:1 pixels at maximum scale. You may wish to set this according to screen density - on a retina screen, 1:1 may still be too small. Consider using setMinimumDpi(int), which is density aware.
Parameters:maxScale - maximum scale expressed as a source/view pixels ratio.
-
public final void setMinScale(float minScale)
Set the minimum scale allowed. A value of 1 means 1:1 pixels at minimum scale. You may wish to set this according to screen density. Consider using setMaximumDpi(int), which is density aware.
Parameters:minScale - minimum scale expressed as a source/view pixels ratio.
-
public final void setMinimumDpi(int dpi)
This is a screen density aware alternative to setMaxScale(float); it allows you to express the maximum allowed scale in terms of the minimum pixel density. This avoids the problem of 1:1 scale still being too small on a high density screen. A sensible starting point is 160 - the default used by this view.
Parameters:dpi - Source image pixel density at maximum zoom.
-
public final void setMaximumDpi(int dpi)
This is a screen density aware alternative to setMinScale(float); it allows you to express the minimum allowed scale in terms of the maximum pixel density.
Parameters:dpi - Source image pixel density at minimum zoom.
-
public float getMaxScale()
Returns the maximum allowed scale. Returns:the maximum scale as a source/view pixels ratio.
-
public final float getMinScale()
Returns the minimum allowed scale. Returns:the minimum scale as a source/view pixels ratio.
-
public void setMinimumTileDpi(int minimumTileDpi)
By default, image tiles are at least as high resolution as the screen. For a retina screen this may not be necessary, and may increase the likelihood of an OutOfMemoryError. This method sets a DPI at which higher resolution tiles should be loaded. Using a lower number will on average use less memory but result in a lower quality image. 160-240dpi will usually be enough. This should be called before setting the image source, because it affects which tiles get loaded. When using an untiled source image this method has no effect.
Parameters:minimumTileDpi - Tile loading threshold.
-
[@Nullable](https://developer.android.com/reference/android/support.annotation.Nullable.html?is-external=true "class or interface in android")public final[PointF](https://developer.android.com/reference/android/graphics/PointF.html?is-external=true "class or interface in android.graphics")getCenter()
Returns the source point at the center of the view. Returns:the source coordinates current at the center of the view.
-
public final float getScale()
Returns the current scale value. Returns:the current scale as a source/view pixels ratio.
-
public final void setScaleAndCenter(float scale,[@Nullable](https://developer.android.com/reference/android/support.annotation.Nullable.html?is-external=true "class or interface in android")[PointF](https://developer.android.com/reference/android/graphics/PointF.html?is-external=true "class or interface in android.graphics")sCenter)
Externally change the scale and translation of the source image. This may be used with getCenter() and getScale() to restore the scale and zoom after a screen rotate.
Parameters:scale - New scale to set.sCenter - New source image coordinate to center on the screen, subject to boundaries.
-
public final void resetScaleAndCenter()
Fully zoom out and return the image to the middle of the screen. This might be useful if you have a view pager and want images to be reset when the user has moved to another page.
-
public final boolean isReady()
Call to find whether the view is initialised, has dimensions, and will display an image on the next draw. If a preview has been provided, it may be the preview that will be displayed and the full size image may still be loading. If no preview was provided, this is called once the base layer tiles of the full size image are loaded. Returns:true if the view is ready to display an image and accept touch gestures.
-
protected void onReady()
Called once when the view is initialised, has dimensions, and will display an image on the next draw. This is triggered at the same time as SubsamplingScaleImageView.OnImageEventListener.onReady() but allows a subclass to receive this event without using a listener.
-
public final boolean isImageLoaded()
Call to find whether the main image (base layer tiles where relevant) have been loaded. Before this event the view is blank unless a preview was provided. Returns:true if the main image (not the preview) has been loaded and is ready to display.
-
protected void onImageLoaded()
Called once when the full size image or its base layer tiles have been loaded.
-
public final int getSWidth()
Get source width, ignoring orientation. If getOrientation() returns 90 or 270, you can use getSHeight() for the apparent width.
Returns:the source image width in pixels.
-
public final int getSHeight()
Get source height, ignoring orientation. If getOrientation() returns 90 or 270, you can use getSWidth() for the apparent height.
Returns:the source image height in pixels.
-
public final int getOrientation()
Returns the orientation setting. This can return ORIENTATION_USE_EXIF, in which case it doesn't tell you the applied orientation of the image. For that, use getAppliedOrientation().
Returns:the orientation setting. See static fields.
-
public final int getAppliedOrientation()
Returns the actual orientation of the image relative to the source file. This will be based on the source file's EXIF orientation if you're using ORIENTATION_USE_EXIF. Values are 0, 90, 180, 270. Returns:the orientation applied after EXIF information has been extracted. See static fields.
-
[@Nullable](https://developer.android.com/reference/android/support.annotation.Nullable.html?is-external=true "class or interface in android")public final[ImageViewState](../../../../com/davemorrissey/labs/subscaleview/ImageViewState.html "class in com.davemorrissey.labs.subscaleview")getState()
Get the current state of the view (scale, center, orientation) for restoration after rotate. Will return null if the view is not ready.
Returns:an ImageViewState instance representing the current position of the image. null if the view isn't ready.
-
public final boolean isZoomEnabled()
Returns true if zoom gesture detection is enabled. Returns:true if zoom gesture detection is enabled.
-
public final void setZoomEnabled(boolean zoomEnabled)
Enable or disable zoom gesture detection. Disabling zoom locks the the current scale.
Parameters:zoomEnabled - true to enable zoom gestures, false to disable.
-
public final boolean isQuickScaleEnabled()
Returns true if double tap & swipe to zoom is enabled. Returns:true if double tap & swipe to zoom is enabled.
-
public final void setQuickScaleEnabled(boolean quickScaleEnabled)
Enable or disable double tap & swipe to zoom.
Parameters:quickScaleEnabled - true to enable quick scale, false to disable.
-
public final boolean isPanEnabled()
Returns true if pan gesture detection is enabled. Returns:true if pan gesture detection is enabled.
-
public final void setPanEnabled(boolean panEnabled)
Enable or disable pan gesture detection. Disabling pan causes the image to be centered. Pan can still be changed from code.
Parameters:panEnabled - true to enable panning, false to disable.
-
public final void setTileBackgroundColor(int tileBgColor)
Set a solid color to render behind tiles, useful for displaying transparent PNGs.
Parameters:tileBgColor - Background color for tiles.
-
public final void setDoubleTapZoomScale(float doubleTapZoomScale)
Set the scale the image will zoom in to when double tapped. This also the scale point where a double tap is interpreted as a zoom out gesture - if the scale is greater than 90% of this value, a double tap zooms out. Avoid using values greater than the max zoom.
Parameters:doubleTapZoomScale - New value for double tap gesture zoom scale.
-
public final void setDoubleTapZoomDpi(int dpi)
A density aware alternative to setDoubleTapZoomScale(float); this allows you to express the scale the image will zoom in to when double tapped in terms of the image pixel density. Values lower than the max scale will be ignored. A sensible starting point is 160 - the default used by this view.
Parameters:dpi - New value for double tap gesture zoom scale.
-
public final void setDoubleTapZoomStyle(int doubleTapZoomStyle)
Set the type of zoom animation to be used for double taps. See static fields.
Parameters:doubleTapZoomStyle - New value for zoom style.
-
public final void setDoubleTapZoomDuration(int durationMs)
Set the duration of the double tap zoom animation.
Parameters:durationMs - Duration in milliseconds.
-
public void setExecutor([@NonNull](https://developer.android.com/reference/android/support.annotation.NonNull.html?is-external=true "class or interface in android")[Executor](https://developer.android.com/reference/java/util/concurrent/Executor.html?is-external=true "class or interface in java.util.concurrent")executor)
Provide an Executor to be used for loading images. By default, AsyncTask.THREAD_POOL_EXECUTOR is used to minimise contention with other background work the app is doing. You can also choose to use AsyncTask.SERIAL_EXECUTOR if you want to limit concurrent background tasks. Alternatively you can supply an Executor of your own to avoid any contention. It is strongly recommended to use a single executor instance for the life of your application, not one per view instance.
Warning: If you are using a custom implementation of ImageRegionDecoder, and you supply an executor with more than one thread, you must make sure your implementation supports multi-threaded bitmap decoding or has appropriate internal synchronization. From SDK 21, Android's BitmapRegionDecoder uses an internal lock so it is thread safe but there is no advantage to using multiple threads.
Parameters:executor - an Executor for image loading.
-
public void setEagerLoadingEnabled(boolean eagerLoadingEnabled)
Enable or disable eager loading of tiles that appear on screen during gestures or animations, while the gesture or animation is still in progress. By default this is enabled to improve responsiveness, but it can result in tiles being loaded and discarded more rapidly than necessary and reduce the animation frame rate on old/cheap devices. Disable this on older devices if you see poor performance. Tiles will then be loaded only when gestures and animations are completed.
Parameters:eagerLoadingEnabled - true to enable loading during gestures, false to delay loading until gestures end
-
public final void setDebug(boolean debug)
Enables visual debugging, showing tile boundaries and sizes.
Parameters:debug - true to enable debugging, false to disable.
-
public boolean hasImage()
Check if an image has been set. The image may not have been loaded and displayed yet. Returns:If an image is currently set.
-
public void setOnLongClickListener([View.OnLongClickListener](https://developer.android.com/reference/android/view/View.OnLongClickListener.html?is-external=true "class or interface in android.view")onLongClickListener)
Overrides:setOnLongClickListener in class View
-
public void setOnImageEventListener([SubsamplingScaleImageView.OnImageEventListener](../../../../com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.OnImageEventListener.html "interface in com.davemorrissey.labs.subscaleview")onImageEventListener)
Add a listener allowing notification of load and error events. Extend SubsamplingScaleImageView.DefaultOnImageEventListener to simplify implementation.
Parameters:onImageEventListener - an SubsamplingScaleImageView.OnImageEventListener instance.
-
public void setOnStateChangedListener([SubsamplingScaleImageView.OnStateChangedListener](../../../../com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.OnStateChangedListener.html "interface in com.davemorrissey.labs.subscaleview")onStateChangedListener)
Add a listener for pan and zoom events. Extend SubsamplingScaleImageView.DefaultOnStateChangedListener to simplify implementation.
Parameters:onStateChangedListener - an SubsamplingScaleImageView.OnStateChangedListener instance.
-
[@Nullable](https://developer.android.com/reference/android/support.annotation.Nullable.html?is-external=true "class or interface in android")public[SubsamplingScaleImageView.AnimationBuilder](../../../../com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.AnimationBuilder.html "class in com.davemorrissey.labs.subscaleview")animateCenter([PointF](https://developer.android.com/reference/android/graphics/PointF.html?is-external=true "class or interface in android.graphics")sCenter)
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. If doing this would move the image beyond the edges of the screen, the image is instead animated to move the center point as near to the center of the screen as is allowed - it's guaranteed to be on screen.
Parameters:sCenter - Target center pointReturns:SubsamplingScaleImageView.AnimationBuilder instance. Call SubsamplingScaleImageView.AnimationBuilder.start() to start the anim.
-
[@Nullable](https://developer.android.com/reference/android/support.annotation.Nullable.html?is-external=true "class or interface in android")public[SubsamplingScaleImageView.AnimationBuilder](../../../../com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.AnimationBuilder.html "class in com.davemorrissey.labs.subscaleview")animateScale(float scale)
Creates a scale animation builder, that when started will animate a zoom in or out. If this would move the image beyond the panning limits, the image is automatically panned during the animation.
Parameters:scale - Target scale.Returns:SubsamplingScaleImageView.AnimationBuilder instance. Call SubsamplingScaleImageView.AnimationBuilder.start() to start the anim.
-
[@Nullable](https://developer.android.com/reference/android/support.annotation.Nullable.html?is-external=true "class or interface in android")public[SubsamplingScaleImageView.AnimationBuilder](../../../../com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.AnimationBuilder.html "class in com.davemorrissey.labs.subscaleview")animateScaleAndCenter(float scale,[PointF](https://developer.android.com/reference/android/graphics/PointF.html?is-external=true "class or interface in android.graphics")sCenter)
Creates a scale animation builder, that when started will animate a zoom in or out. If this would move the image beyond the panning limits, the image is automatically panned during the animation.
Parameters:scale - Target scale.sCenter - Target source center.Returns:SubsamplingScaleImageView.AnimationBuilder instance. Call SubsamplingScaleImageView.AnimationBuilder.start() to start the anim.