-
- All Implemented Interfaces:
-
android.graphics.drawable.Drawable.Callback,android.view.KeyEvent.Callback,android.view.accessibility.AccessibilityEventSource,androidx.core.view.TintableBackgroundView,androidx.core.widget.TintableImageSourceView
public class PhotoView extends AppCompatImageView
A zoomable ImageView. See PhotoViewAttacher for most of the details on how the zooming is accomplished
-
-
Field Summary
Fields Modifier and Type Field Description private PhotoViewAttacherattacherprivate ShapeImageView.ShapeTypeshapeType
-
Constructor Summary
Constructors Constructor Description PhotoView(Context context)PhotoView(Context context, AttributeSet attr)PhotoView(Context context, AttributeSet attr, int defStyle)
-
Method Summary
Modifier and Type Method Description PhotoViewAttachergetAttacher()Get the current PhotoViewAttacher for this view. voidsetShapeType(ShapeImageView.ShapeType shapeType)ImageView.ScaleTypegetScaleType()MatrixgetImageMatrix()voidsetOnLongClickListener(View.OnLongClickListener l)voidsetOnClickListener(View.OnClickListener l)voidsetScaleType(ImageView.ScaleType scaleType)voidsetSrcScaleType(ShapeImageView.ShapeScaleType scaleType)ShapeImageView.ShapeScaleTypegetSrcScaleType()voidsetImageDrawable(Drawable drawable)voidsetExitDrawableWidthHeight(int requestWidth, int requestHeight)voidsetImageResource(int resId)voidsetImageURI(Uri uri)voidsetRotationTo(float rotationDegree)voidsetRotationBy(float rotationDegree)booleanisZoomable()voidsetZoomable(boolean zoomable)RectFgetDisplayRect()voidgetDisplayMatrix(Matrix matrix)booleansetDisplayMatrix(Matrix finalRectangle)voidgetSuppMatrix(Matrix matrix)booleansetSuppMatrix(Matrix matrix)floatgetMinimumScale()floatgetMediumScale()floatgetMaximumScale()floatgetScale()voidsetAllowParentInterceptOnEdge(boolean allow)voidsetMinimumScale(float minimumScale)voidsetMediumScale(float mediumScale)voidsetMaximumScale(float maximumScale)voidsetScaleLevels(float minimumScale, float mediumScale, float maximumScale)voidsetOnMatrixChangeListener(OnMatrixChangedListener listener)voidsetOnPhotoTapListener(OnPhotoTapListener listener)voidsetOnOutsidePhotoTapListener(OnOutsidePhotoTapListener listener)voidsetOnViewTapListener(OnViewTapListener listener)voidsetOnViewDragListener(OnViewDragListener listener)voidsetScale(float scale)voidsetScale(float scale, boolean animate)voidsetScale(float scale, float focalX, float focalY, boolean animate)voidsetZoomTransitionDuration(int milliseconds)voidsetOnDoubleTapListener(GestureDetector.OnDoubleTapListener onDoubleTapListener)voidsetOnScaleChangeListener(OnScaleChangedListener onScaleChangedListener)voidsetOnSingleFlingListener(OnSingleFlingListener onSingleFlingListener)voidsetStartWidth(float mStartWidth)voidsetStartHeight(float mStartHeight)voidsetExitMode(boolean mode)booleanisClickOpenImage()voidsetClickOpenImage(boolean clickOpenImage)voidsetNoneClickView(boolean noneClickView)voidsetExitFloat(float exitFloat)voidsetAutoCropHeightWidthRatio(float autoCropHeightWidthRatio)voidsetRadius(int leftTopRadius, int rightTopRadius, int rightBottomRadius, int leftBottomRadius)voidsetRelativeRadius(int startTopRadius, int endTopRadius, int endBottomRadius, int startBottomRadius)voidsetImageFilePath(String filePath)设置之后才可以支持超大图,必须在设置图片之后才可以调用,否则无作用 voidsetImageMatrix(Matrix matrix)-
Methods inherited from class androidx.appcompat.widget.AppCompatImageView
getSupportBackgroundTintList, getSupportBackgroundTintMode, getSupportImageTintList, getSupportImageTintMode, hasOverlappingRendering, setBackgroundDrawable, setBackgroundResource, setImageBitmap, setImageDrawable, setImageResource, setImageURI, setSupportBackgroundTintList, setSupportBackgroundTintMode, setSupportImageTintList, setSupportImageTintMode -
Methods inherited from class android.widget.ImageView
animateTransform, clearColorFilter, drawableHotspotChanged, getAccessibilityClassName, getAdjustViewBounds, getBaseline, getBaselineAlignBottom, getColorFilter, getCropToPadding, getDrawable, getImageAlpha, getImageMatrix, getImageTintBlendMode, getImageTintList, getImageTintMode, getMaxHeight, getMaxWidth, getScaleType, invalidateDrawable, isOpaque, jumpDrawablesToCurrentState, onCreateDrawableState, onRtlPropertiesChanged, onVisibilityAggregated, setAdjustViewBounds, setAlpha, setBaseline, setBaselineAlignBottom, setColorFilter, setCropToPadding, setImageAlpha, setImageIcon, setImageLevel, setImageMatrix, setImageState, setImageTintBlendMode, setImageTintList, setImageTintMode, setMaxHeight, setMaxWidth, setScaleType, setSelected, setVisibility -
Methods inherited from class android.view.View
addChildrenForAccessibility, addExtraDataToAccessibilityNodeInfo, addFocusables, addKeyboardNavigationClusters, addOnAttachStateChangeListener, addOnLayoutChangeListener, addOnUnhandledKeyEventListener, addTouchables, animate, announceForAccessibility, autofill, bringToFront, buildDrawingCache, buildLayer, callOnClick, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, cancelDragAndDrop, cancelLongPress, cancelPendingInputEvents, checkInputConnectionProxy, clearAnimation, clearFocus, clearViewTranslationCallback, combineMeasuredStates, computeScroll, computeSystemWindowInsets, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchApplyWindowInsets, dispatchCapturedPointerEvent, dispatchConfigurationChanged, dispatchCreateViewTranslationRequest, dispatchDisplayHint, dispatchDragEvent, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPointerCaptureChanged, dispatchPopulateAccessibilityEvent, dispatchProvideAutofillStructure, dispatchProvideStructure, dispatchScrollCaptureSearch, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowInsetsAnimationEnd, dispatchWindowInsetsAnimationPrepare, dispatchWindowInsetsAnimationProgress, dispatchWindowInsetsAnimationStart, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, draw, findFocus, findOnBackInvokedDispatcher, findViewById, findViewWithTag, findViewsWithText, focusSearch, forceHasOverlappingRendering, forceLayout, gatherTransparentRegion, generateDisplayHash, generateViewId, getAccessibilityDelegate, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityPaneTitle, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAllowedHandwritingDelegatePackageName, getAllowedHandwritingDelegatorPackageName, getAlpha, getAnimation, getAnimationMatrix, getApplicationWindowToken, getAttributeResolutionStack, getAttributeSourceResourceMap, getAutofillHints, getAutofillId, getAutofillType, getAutofillValue, getBackground, getBackgroundTintBlendMode, getBackgroundTintList, getBackgroundTintMode, getBottom, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentCaptureSession, getContentDescription, getContext, getDefaultFocusHighlightEnabled, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getExplicitStyle, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusable, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintBlendMode, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getHandler, getHandwritingBoundsOffsetBottom, getHandwritingBoundsOffsetLeft, getHandwritingBoundsOffsetRight, getHandwritingBoundsOffsetTop, getHandwritingDelegatorCallback, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarThumbDrawable, getHorizontalScrollbarTrackDrawable, getId, getImportantForAccessibility, getImportantForAutofill, getImportantForContentCapture, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLocalVisibleRect, getLocationInSurface, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineAmbientShadowColor, getOutlineProvider, getOutlineSpotShadowColor, getOverScrollMode, getOverlay, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getPointerIcon, getPreferKeepClearRects, getReceiveContentMimeTypes, getResources, getRevealOnFocusHint, getRight, getRootSurfaceControl, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollCaptureHint, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getSourceLayoutResId, getStateDescription, getStateListAnimator, getSystemGestureExclusionRects, getSystemUiVisibility, getTag, getTextAlignment, getTextDirection, getTooltipText, getTop, getTouchDelegate, getTouchables, getTransitionAlpha, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getUniqueDrawingId, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarThumbDrawable, getVerticalScrollbarTrackDrawable, getVerticalScrollbarWidth, getViewTranslationResponse, getViewTreeObserver, getVisibility, getWidth, getWindowId, getWindowInsetsController, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasExplicitFocusable, hasFocus, hasFocusable, hasNestedScrollingParent, hasOnClickListeners, hasOnLongClickListeners, hasPointerCapture, hasTransientState, hasWindowFocus, inflate, invalidate, invalidateOutline, isAccessibilityDataSensitive, isAccessibilityFocused, isAccessibilityHeading, isActivated, isAttachedToWindow, isAutoHandwritingEnabled, isClickable, isContextClickable, isCredential, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isForceDarkAllowed, isHandwritingDelegate, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isImportantForAutofill, isImportantForContentCapture, isInEditMode, isInLayout, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isPaddingRelative, isPivotSet, isPreferKeepClear, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScreenReaderFocusable, isScrollContainer, isScrollbarFadingEnabled, isSelected, isShowingLayoutBounds, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVisibleToUserForAutofill, keyboardNavigationClusterSearch, layout, measure, offsetLeftAndRight, offsetTopAndBottom, onApplyWindowInsets, onCancelPendingInputEvents, onCapturedPointerEvent, onCheckIsTextEditor, onCreateInputConnection, onCreateViewTranslationRequest, onCreateVirtualViewTranslationRequests, onDragEvent, onDrawForeground, onFilterTouchEventForSecurity, onFinishTemporaryDetach, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onPointerCaptureChange, onPopulateAccessibilityEvent, onProvideAutofillStructure, onProvideAutofillVirtualStructure, onProvideContentCaptureStructure, onProvideStructure, onProvideVirtualStructure, onReceiveContent, onResolvePointerIcon, onScreenStateChanged, onScrollCaptureSearch, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onViewTranslationResponse, onVirtualViewTranslationResponses, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, performAccessibilityAction, performClick, performContextClick, performHapticFeedback, performLongClick, performReceiveContent, playSoundEffect, post, postDelayed, postInvalidate, postInvalidateDelayed, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, releasePointerCapture, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, removeOnUnhandledKeyEventListener, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocusFromTouch, requestLayout, requestPointerCapture, requestRectangleOnScreen, requestUnbufferedDispatch, requireViewById, resetPivot, resolveSize, resolveSizeAndState, restoreDefaultFocus, restoreHierarchyState, saveAttributeDataForStyleable, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDataSensitive, setAccessibilityDelegate, setAccessibilityHeading, setAccessibilityLiveRegion, setAccessibilityPaneTitle, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAllowClickWhenDisabled, setAllowedHandwritingDelegatePackage, setAllowedHandwritingDelegatorPackage, setAnimation, setAnimationMatrix, setAutoHandwritingEnabled, setAutofillHints, setAutofillId, setBackground, setBackgroundColor, setBackgroundTintBlendMode, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentCaptureSession, setContentDescription, setContextClickable, setDefaultFocusHighlightEnabled, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setFocusedByDefault, setForceDarkAllowed, setForeground, setForegroundGravity, setForegroundTintBlendMode, setForegroundTintList, setForegroundTintMode, setHandwritingBoundsOffsets, setHandwritingDelegatorCallback, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHorizontalScrollbarThumbDrawable, setHorizontalScrollbarTrackDrawable, setHovered, setId, setImportantForAccessibility, setImportantForAutofill, setImportantForContentCapture, setIsCredential, setIsHandwritingDelegate, setKeepScreenOn, setKeyboardNavigationCluster, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLeftTopRightBottom, setLongClickable, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnCapturedPointerListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnReceiveContentListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineAmbientShadowColor, setOutlineProvider, setOutlineSpotShadowColor, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPointerIcon, setPreferKeepClear, setPreferKeepClearRects, setPressed, setRenderEffect, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScreenReaderFocusable, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollBarSize, setScrollBarStyle, setScrollCaptureCallback, setScrollCaptureHint, setScrollContainer, setScrollIndicators, setScrollX, setScrollY, setScrollbarFadingEnabled, setSoundEffectsEnabled, setStateDescription, setStateListAnimator, setSystemGestureExclusionRects, setSystemUiVisibility, setTag, setTextAlignment, setTextDirection, setTooltipText, setTop, setTouchDelegate, setTransitionAlpha, setTransitionName, setTransitionVisibility, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVerticalScrollbarThumbDrawable, setVerticalScrollbarTrackDrawable, setViewTranslationCallback, setWillNotCacheDrawing, setWillNotDraw, setWindowInsetsAnimationCallback, setX, setY, setZ, showContextMenu, startActionMode, startAnimation, startDrag, startDragAndDrop, startNestedScroll, stopNestedScroll, toString, transformMatrixToGlobal, transformMatrixToLocal, unscheduleDrawable, updateDragShadow, willNotCacheDrawing, willNotDraw -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
PhotoView
PhotoView(Context context)
-
PhotoView
PhotoView(Context context, AttributeSet attr)
-
PhotoView
PhotoView(Context context, AttributeSet attr, int defStyle)
-
-
Method Detail
-
getAttacher
PhotoViewAttacher getAttacher()
Get the current PhotoViewAttacher for this view. Be wary of holding on to referencesto this attacher, as it has a reference to this view, which, if a reference is held in thewrong place, can cause memory leaks.
-
setShapeType
void setShapeType(ShapeImageView.ShapeType shapeType)
-
getScaleType
ImageView.ScaleType getScaleType()
-
getImageMatrix
Matrix getImageMatrix()
-
setOnLongClickListener
void setOnLongClickListener(View.OnLongClickListener l)
-
setOnClickListener
void setOnClickListener(View.OnClickListener l)
-
setScaleType
void setScaleType(ImageView.ScaleType scaleType)
-
setSrcScaleType
void setSrcScaleType(ShapeImageView.ShapeScaleType scaleType)
-
getSrcScaleType
ShapeImageView.ShapeScaleType getSrcScaleType()
-
setImageDrawable
void setImageDrawable(Drawable drawable)
-
setExitDrawableWidthHeight
void setExitDrawableWidthHeight(int requestWidth, int requestHeight)
-
setImageResource
void setImageResource(int resId)
-
setImageURI
void setImageURI(Uri uri)
-
setRotationTo
void setRotationTo(float rotationDegree)
-
setRotationBy
void setRotationBy(float rotationDegree)
-
isZoomable
boolean isZoomable()
-
setZoomable
void setZoomable(boolean zoomable)
-
getDisplayRect
RectF getDisplayRect()
-
getDisplayMatrix
void getDisplayMatrix(Matrix matrix)
-
setDisplayMatrix
boolean setDisplayMatrix(Matrix finalRectangle)
-
getSuppMatrix
void getSuppMatrix(Matrix matrix)
-
setSuppMatrix
boolean setSuppMatrix(Matrix matrix)
-
getMinimumScale
float getMinimumScale()
-
getMediumScale
float getMediumScale()
-
getMaximumScale
float getMaximumScale()
-
getScale
float getScale()
-
setAllowParentInterceptOnEdge
void setAllowParentInterceptOnEdge(boolean allow)
-
setMinimumScale
void setMinimumScale(float minimumScale)
-
setMediumScale
void setMediumScale(float mediumScale)
-
setMaximumScale
void setMaximumScale(float maximumScale)
-
setScaleLevels
void setScaleLevels(float minimumScale, float mediumScale, float maximumScale)
-
setOnMatrixChangeListener
void setOnMatrixChangeListener(OnMatrixChangedListener listener)
-
setOnPhotoTapListener
void setOnPhotoTapListener(OnPhotoTapListener listener)
-
setOnOutsidePhotoTapListener
void setOnOutsidePhotoTapListener(OnOutsidePhotoTapListener listener)
-
setOnViewTapListener
void setOnViewTapListener(OnViewTapListener listener)
-
setOnViewDragListener
void setOnViewDragListener(OnViewDragListener listener)
-
setScale
void setScale(float scale)
-
setScale
void setScale(float scale, boolean animate)
-
setScale
void setScale(float scale, float focalX, float focalY, boolean animate)
-
setZoomTransitionDuration
void setZoomTransitionDuration(int milliseconds)
-
setOnDoubleTapListener
void setOnDoubleTapListener(GestureDetector.OnDoubleTapListener onDoubleTapListener)
-
setOnScaleChangeListener
void setOnScaleChangeListener(OnScaleChangedListener onScaleChangedListener)
-
setOnSingleFlingListener
void setOnSingleFlingListener(OnSingleFlingListener onSingleFlingListener)
-
setStartWidth
void setStartWidth(float mStartWidth)
-
setStartHeight
void setStartHeight(float mStartHeight)
-
setExitMode
void setExitMode(boolean mode)
-
isClickOpenImage
boolean isClickOpenImage()
-
setClickOpenImage
void setClickOpenImage(boolean clickOpenImage)
-
setNoneClickView
void setNoneClickView(boolean noneClickView)
-
setExitFloat
void setExitFloat(float exitFloat)
-
setAutoCropHeightWidthRatio
void setAutoCropHeightWidthRatio(float autoCropHeightWidthRatio)
-
setRadius
void setRadius(int leftTopRadius, int rightTopRadius, int rightBottomRadius, int leftBottomRadius)
-
setRelativeRadius
void setRelativeRadius(int startTopRadius, int endTopRadius, int endBottomRadius, int startBottomRadius)
-
setImageFilePath
void setImageFilePath(String filePath)
设置之后才可以支持超大图,必须在设置图片之后才可以调用,否则无作用
- Parameters:
filePath- 图片本地路径
-
setImageMatrix
void setImageMatrix(Matrix matrix)
-
-
-
-