public class PhotoViewAttacher extends java.lang.Object implements IPhotoView, android.view.View.OnTouchListener, OnGestureListener, android.view.ViewTreeObserver.OnGlobalLayoutListener
| 限定符和类型 | 类和说明 |
|---|---|
static interface |
PhotoViewAttacher.OnMatrixChangedListener
Interface definition for a callback to be invoked when the internal Matrix has changed for
this View.
|
static interface |
PhotoViewAttacher.OnPhotoTapListener
Interface definition for a callback to be invoked when the Photo is tapped with a single
tap.
|
static interface |
PhotoViewAttacher.OnScaleChangeListener
Interface definition for callback to be invoked when attached ImageView scale changes
|
static interface |
PhotoViewAttacher.OnSingleFlingListener
Interface definition for a callback to be invoked when the ImageView is fling with a single
touch
|
static interface |
PhotoViewAttacher.OnViewTapListener
Interface definition for a callback to be invoked when the ImageView is tapped with a single
tap.
|
DEFAULT_MAX_SCALE, DEFAULT_MID_SCALE, DEFAULT_MIN_SCALE, DEFAULT_ZOOM_DURATION| 构造器和说明 |
|---|
PhotoViewAttacher(android.widget.ImageView imageView) |
PhotoViewAttacher(android.widget.ImageView imageView,
boolean zoomable) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
canZoom()
Returns true if the PhotoView is set to allow zooming of Photos.
|
void |
cleanup()
Clean-up the resources attached to this object.
|
void |
getDisplayMatrix(android.graphics.Matrix matrix)
Get the display matrix
|
android.graphics.RectF |
getDisplayRect()
Gets the Display Rectangle of the currently displayed Drawable.
|
android.graphics.Matrix |
getImageMatrix() |
android.widget.ImageView |
getImageView() |
IPhotoView |
getIPhotoViewImplementation()
Will return instance of IPhotoView (eg.
|
float |
getMaximumScale() |
float |
getMediumScale() |
float |
getMinimumScale() |
float |
getScale()
Returns the current scale value
|
android.widget.ImageView.ScaleType |
getScaleType()
Return the current scale type in use by the ImageView.
|
void |
getSuppMatrix(android.graphics.Matrix matrix)
Get the current support matrix
|
android.graphics.Bitmap |
getVisibleRectangleBitmap()
Extracts currently visible area to Bitmap object, if there is no image loaded yet or the
ImageView is already destroyed, returns
null |
void |
onDrag(float dx,
float dy) |
void |
onFling(float startX,
float startY,
float velocityX,
float velocityY) |
void |
onGlobalLayout() |
void |
onScale(float scaleFactor,
float focusX,
float focusY) |
boolean |
onTouch(android.view.View v,
android.view.MotionEvent ev) |
void |
resetMatrix()
Resets the Matrix back to FIT_CENTER, and then displays it.s
|
void |
setAllowParentInterceptOnEdge(boolean allow)
Whether to allow the ImageView's parent to intercept the touch event when the photo is scroll
to it's horizontal edge.
|
void |
setBaseRotation(float degrees) |
boolean |
setDisplayMatrix(android.graphics.Matrix finalMatrix)
Sets the Display Matrix of the currently displayed Drawable.
|
void |
setMaximumScale(float maximumScale)
Sets the maximum scale level.
|
void |
setMediumScale(float mediumScale)
Sets the medium scale level.
|
void |
setMinimumScale(float minimumScale)
Sets the minimum scale level.
|
void |
setOnDoubleTapListener(android.view.GestureDetector.OnDoubleTapListener newOnDoubleTapListener)
Sets custom double tap listener, to intercept default given functions.
|
void |
setOnLongClickListener(android.view.View.OnLongClickListener listener)
Register a callback to be invoked when the Photo displayed by this view is long-pressed.
|
void |
setOnMatrixChangeListener(PhotoViewAttacher.OnMatrixChangedListener listener)
Register a callback to be invoked when the Matrix has changed for this View.
|
void |
setOnPhotoTapListener(PhotoViewAttacher.OnPhotoTapListener listener)
Register a callback to be invoked when the Photo displayed by this View is tapped with a
single tap.
|
void |
setOnScaleChangeListener(PhotoViewAttacher.OnScaleChangeListener onScaleChangeListener)
Will report back about scale changes
|
void |
setOnSingleFlingListener(PhotoViewAttacher.OnSingleFlingListener onSingleFlingListener)
Will report back about fling(single touch)
|
void |
setOnViewTapListener(PhotoViewAttacher.OnViewTapListener listener)
Register a callback to be invoked when the View is tapped with a single tap.
|
void |
setRotationBy(float degrees)
Enables rotation via PhotoView internal functions.
|
void |
setRotationTo(float degrees)
Enables rotation via PhotoView internal functions.
|
void |
setScale(float scale)
Changes the current scale to the specified value.
|
void |
setScale(float scale,
boolean animate)
Changes the current scale to the specified value.
|
void |
setScale(float scale,
float focalX,
float focalY,
boolean animate)
Changes the current scale to the specified value, around the given focal point.
|
void |
setScaleLevels(float minimumScale,
float mediumScale,
float maximumScale)
Allows to set all three scale levels at once, so you don't run into problem with setting
medium/minimum scale before the maximum one
|
void |
setScaleType(android.widget.ImageView.ScaleType scaleType)
Controls how the image should be resized or moved to match the size of the ImageView.
|
void |
setZoomable(boolean zoomable)
Allows you to enable/disable the zoom functionality on the ImageView.
|
void |
setZoomInterpolator(android.view.animation.Interpolator interpolator)
Set the zoom interpolator
|
void |
setZoomTransitionDuration(int milliseconds)
Allows to change zoom transition speed, default value is 200 (PhotoViewAttacher.DEFAULT_ZOOM_DURATION).
|
void |
update() |
public PhotoViewAttacher(android.widget.ImageView imageView)
public PhotoViewAttacher(android.widget.ImageView imageView,
boolean zoomable)
public void setOnDoubleTapListener(android.view.GestureDetector.OnDoubleTapListener newOnDoubleTapListener)
IPhotoViewsetOnDoubleTapListener 在接口中 IPhotoViewnewOnDoubleTapListener - custom OnDoubleTapListener to be set on ImageViewpublic void setOnScaleChangeListener(PhotoViewAttacher.OnScaleChangeListener onScaleChangeListener)
IPhotoViewsetOnScaleChangeListener 在接口中 IPhotoViewonScaleChangeListener - OnScaleChangeListener instancepublic void setOnSingleFlingListener(PhotoViewAttacher.OnSingleFlingListener onSingleFlingListener)
IPhotoViewsetOnSingleFlingListener 在接口中 IPhotoViewonSingleFlingListener - OnSingleFlingListener instancepublic boolean canZoom()
IPhotoViewcanZoom 在接口中 IPhotoViewpublic void cleanup()
View.onDetachedFromWindow() or
from Activity.onDestroy(). This is automatically called if you are using
PhotoView.public android.graphics.RectF getDisplayRect()
IPhotoViewgetDisplayRect 在接口中 IPhotoViewpublic boolean setDisplayMatrix(android.graphics.Matrix finalMatrix)
IPhotoViewsetDisplayMatrix 在接口中 IPhotoViewfinalMatrix - target matrix to set PhotoView topublic void setBaseRotation(float degrees)
public void setRotationTo(float degrees)
IPhotoViewsetRotationTo 在接口中 IPhotoViewdegrees - - Degree to rotate PhotoView to, should be in range 0 to 360public void setRotationBy(float degrees)
IPhotoViewsetRotationBy 在接口中 IPhotoViewdegrees - - Degree to rotate PhotoView by, should be in range 0 to 360public android.widget.ImageView getImageView()
public float getMinimumScale()
getMinimumScale 在接口中 IPhotoViewImageView.ScaleType.public float getMediumScale()
getMediumScale 在接口中 IPhotoViewImageView.ScaleType.public float getMaximumScale()
getMaximumScale 在接口中 IPhotoViewImageView.ScaleType.public float getScale()
IPhotoViewgetScale 在接口中 IPhotoViewpublic android.widget.ImageView.ScaleType getScaleType()
IPhotoViewgetScaleType 在接口中 IPhotoViewpublic void onDrag(float dx,
float dy)
onDrag 在接口中 OnGestureListenerpublic void onFling(float startX,
float startY,
float velocityX,
float velocityY)
onFling 在接口中 OnGestureListenerpublic void onGlobalLayout()
onGlobalLayout 在接口中 android.view.ViewTreeObserver.OnGlobalLayoutListenerpublic void onScale(float scaleFactor,
float focusX,
float focusY)
onScale 在接口中 OnGestureListenerpublic boolean onTouch(android.view.View v,
android.view.MotionEvent ev)
onTouch 在接口中 android.view.View.OnTouchListenerpublic void setAllowParentInterceptOnEdge(boolean allow)
IPhotoViewsetAllowParentInterceptOnEdge 在接口中 IPhotoViewallow - whether to allow intercepting by parent element or notpublic void setMinimumScale(float minimumScale)
IPhotoViewImageView.ScaleType.setMinimumScale 在接口中 IPhotoViewminimumScale - minimum allowed scalepublic void setMediumScale(float mediumScale)
IPhotoViewImageView.ScaleType.setMediumScale 在接口中 IPhotoViewmediumScale - medium scale presetpublic void setMaximumScale(float maximumScale)
IPhotoViewImageView.ScaleType.setMaximumScale 在接口中 IPhotoViewmaximumScale - maximum allowed scale presetpublic void setScaleLevels(float minimumScale,
float mediumScale,
float maximumScale)
IPhotoViewsetScaleLevels 在接口中 IPhotoViewminimumScale - minimum allowed scalemediumScale - medium allowed scalemaximumScale - maximum allowed scale presetpublic void setOnLongClickListener(android.view.View.OnLongClickListener listener)
IPhotoViewsetOnLongClickListener 在接口中 IPhotoViewlistener - - Listener to be registered.public void setOnMatrixChangeListener(PhotoViewAttacher.OnMatrixChangedListener listener)
IPhotoViewsetOnMatrixChangeListener 在接口中 IPhotoViewlistener - - Listener to be registered.public void setOnPhotoTapListener(PhotoViewAttacher.OnPhotoTapListener listener)
IPhotoViewsetOnPhotoTapListener 在接口中 IPhotoViewlistener - - Listener to be registered.public void setOnViewTapListener(PhotoViewAttacher.OnViewTapListener listener)
IPhotoViewsetOnViewTapListener 在接口中 IPhotoViewlistener - - Listener to be registered.public void setScale(float scale)
IPhotoViewsetScale 在接口中 IPhotoViewscale - - Value to scale topublic void setScale(float scale,
boolean animate)
IPhotoViewsetScale 在接口中 IPhotoViewscale - - Value to scale toanimate - - Whether to animate the scalepublic void setScale(float scale,
float focalX,
float focalY,
boolean animate)
IPhotoViewsetScale 在接口中 IPhotoViewscale - - Value to scale tofocalX - - X Focus PointfocalY - - Y Focus Pointanimate - - Whether to animate the scalepublic void setZoomInterpolator(android.view.animation.Interpolator interpolator)
interpolator - the zoom interpolatorpublic void setScaleType(android.widget.ImageView.ScaleType scaleType)
IPhotoViewImageView.ScaleType.setScaleType 在接口中 IPhotoViewscaleType - - The desired scaling mode.public void setZoomable(boolean zoomable)
IPhotoViewsetZoomable 在接口中 IPhotoViewzoomable - - Whether the zoom functionality is enabled.public void update()
public void getDisplayMatrix(android.graphics.Matrix matrix)
getDisplayMatrix 在接口中 IPhotoViewmatrix - target matrix to copy topublic void getSuppMatrix(android.graphics.Matrix matrix)
public android.graphics.Matrix getImageMatrix()
public android.graphics.Bitmap getVisibleRectangleBitmap()
IPhotoViewnullgetVisibleRectangleBitmap 在接口中 IPhotoViewpublic void setZoomTransitionDuration(int milliseconds)
IPhotoViewsetZoomTransitionDuration 在接口中 IPhotoViewmilliseconds - duration of zoom interpolationpublic IPhotoView getIPhotoViewImplementation()
IPhotoViewgetIPhotoViewImplementation 在接口中 IPhotoViewpublic void resetMatrix()