public class ZoomPanLayout
extends ViewGroup
Modifier and Type | Class and Description |
---|---|
static interface |
ZoomPanLayout.GestureListener |
static interface |
ZoomPanLayout.ZoomPanListener |
Constructor and Description |
---|
ZoomPanLayout(Context context)
Constructor to use when creating a ZoomPanLayout from code.
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(View child)
Adds a View to the intermediary ViewGroup that manages layout for the ZoomPanLayout.
|
boolean |
addGestureListener(ZoomPanLayout.GestureListener listener)
Adds a GestureListener to the ZoomPanLayout, which will receive gesture events
|
void |
addView(View child) |
boolean |
addZoomPanListener(ZoomPanLayout.ZoomPanListener listener)
Adds a ZoomPanListener to the ZoomPanLayout, which will receive events relating to zoom and pan actions
|
void |
computeScroll() |
int |
getBaseHeight()
Returns the base (un-scaled) height
|
int |
getBaseWidth()
Returns the base (un-scaled) width
|
double |
getScale()
Retrieves the current scale of the ZoomPanLayout
|
int |
getScaledHeight()
Returns the scaled height
|
int |
getScaledWidth()
Returns the scaled width
|
boolean |
isFlinging()
Returns whether the ZoomPanLayout is currently being flung
|
boolean |
onInterceptTouchEvent(MotionEvent event) |
boolean |
onTouchEvent(MotionEvent event) |
void |
removeChild(View child)
Removes a View from the intermediary ViewGroup that manages layout for this ZoomPanLayout
|
boolean |
removeGestureListener(ZoomPanLayout.GestureListener listener)
Removes a GestureListener from the ZoomPanLayout
|
void |
removeView(View child) |
boolean |
removeZoomPanListener(ZoomPanLayout.ZoomPanListener listener)
Removes a ZoomPanListener from the ZoomPanLayout
|
void |
scrollToAndCenter(Point point)
Scrolls and centers the ZoomPanLayout to the x and y values specified by Point
|
void |
scrollToPoint(Point point)
Scrolls the ZoomPanLayout to the x and y values specified by Point
|
void |
setScale(double d)
Sets the scale (0-1) of the ZoomPanLayout
|
void |
setScaleLimits(double min,
double max)
Set minimum and maximum scale values for this ZoomPanLayout.
|
void |
setScaleToFit(boolean shouldScaleToFit)
Determines whether the ZoomPanLayout should limit it's minimum scale to no less than what would be required to fill it's container
|
void |
setShouldIntercept(boolean intercept)
Sets whether the ZoomPanLayout should intercept touch events on it's child views.
|
void |
setSize(int wide,
int tall)
Sets the size (width and height) of the ZoomPanLayout as it should be rendered at a scale of 1f (100%)
|
void |
slideToAndCenter(Point point)
Scrolls and centers the ZoomPanLayout to the x and y values specified by Point using scrolling animation
|
void |
slideToPoint(Point point)
Scrolls the ZoomPanLayout to the x and y values specified by Point using scrolling animation
|
void |
smoothScaleTo(double destination,
int duration)
Scales the ZoomPanLayout with animated progress
|
public ZoomPanLayout(Context context)
context
- (Context) The Context the ZoomPanLayout is running in, through which it can access the current theme, resources, etc.public void setScaleToFit(boolean shouldScaleToFit)
shouldScaleToFit
- (boolean) True to limit minimum scale, false to allow arbitrary minimum scale (see setScaleLimits
)public void setScaleLimits(double min, double max)
shouldScaleToFit
is set to true, the minimum value set here will be ignored
Default values are 0 and 1.min
- max
- public void setShouldIntercept(boolean intercept)
intercept
- (boolean) Boolean value indicating whether the ZoomPanLayout should intercept touch eventspublic void setSize(int wide, int tall)
wide
- widthtall
- heightpublic int getBaseWidth()
public int getBaseHeight()
public int getScaledWidth()
public int getScaledHeight()
public void setScale(double d)
scale
- (double) The new value of the ZoomPanLayout scalepublic double getScale()
public boolean isFlinging()
public boolean addGestureListener(ZoomPanLayout.GestureListener listener)
listener
- (GestureListener) Listener to addpublic boolean removeGestureListener(ZoomPanLayout.GestureListener listener)
listener
- (GestureListener) Listener to removepublic boolean addZoomPanListener(ZoomPanLayout.ZoomPanListener listener)
listener
- (ZoomPanListener) Listener to addpublic boolean removeZoomPanListener(ZoomPanLayout.ZoomPanListener listener)
listener
- (ZoomPanListener) Listener to removepublic void scrollToPoint(Point point)
point
- (Point) Point instance containing the destination x and y valuespublic void scrollToAndCenter(Point point)
point
- (Point) Point instance containing the destination x and y valuespublic void slideToPoint(Point point)
point
- (Point) Point instance containing the destination x and y valuespublic void slideToAndCenter(Point point)
point
- (Point) Point instance containing the destination x and y valuespublic void addChild(View child)
child
- (View) The View to be added to the ZoomPanLayout view treepublic void removeChild(View child)
child
- (View) The View to be removedpublic void smoothScaleTo(double destination, int duration)
destination
- (double) The final scale to animate toduration
- (int) The duration (in milliseconds) of the animationpublic void computeScroll()
public void addView(View child)
public void removeView(View child)
public boolean onInterceptTouchEvent(MotionEvent event)
public boolean onTouchEvent(MotionEvent event)