|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.esri.android.map.Callout
public class Callout
The CalloutView class draws and manages the behavior of a callout window. By default the callout window will have a
width of 150 pixels and height of 60 pixels. This view will automatically be stretched up to 300 pixels (by default,
customizable using setMaxWidth(int)) by 150 pixels (by default, customizable using
setMaxHeight(int)) to accommodate the content that is to appear inside of the callout window. The callout
will automatically add scroll bars to the CalloutView to allow a user to scroll and view the content within.
By default, the callout window is empty and it is likely that you will want to work with the
setContent(View) method to populate the callout window with some Android View (for example, TextView). In
addition, the callout window will not have a title. You can work with the setTitle(String) method to add one
to the callout window.
When the anchor position is set to ANCHOR_POSITION_FLOATING, the callout window will automatically re-adjust
to try and remain on the device's screen when panning. Use the setAnchor(int) method and pass in one of the
ANCHOR POSITION static fields to set the position of the anchor relatively to the callout window.
When the callout window is displayed, it is anchored to a location. This location is defined by the developer by
calling the setCoordinates(Point) method, where a point is passed in. This point must have coordinates
supplied in the MapView's spatial coordinate system. See the MapView for convenience methods to do
conversions from one screen pixels to screen coordinates, or to obtain the spatial coordinate system being used by
the MapView, as needed.
The callout look and feel can be customized by creating a XML file in the res/xml folder of your application. The XML must have the following format:
<resources> <calloutViewStyle titleTextColor="#000000" // some RGB color or a reference to a color backgroundColor="#ffffff" // some RGB color or a reference to a color backgroundAlpha="255" // 0(transparent) to 255(opaque) frameColor="#000000" // some RGB color or a reference to a color flat="true" // draws a 3D frame cornerCurve="0" // the radius of the window's corners' curvature (max=40) anchor="5" /> // the position of the anchor (0-9, see ANCHOR_POSITION_XXX constants) </resources>Once this file has been created, you can either use
setStyle(int) and pass it the reference of the file
(R.xml.MyXmlFileName) or declare an attribut "calloutStyle" for the MapView in your layout. e.g.:
<com.esri.android.map.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapview"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
calloutStyle="@xml/style3">
| Nested Class Summary | |
|---|---|
protected class |
Callout.CalloutInner
|
| Field Summary | |
|---|---|
static int |
ANCHOR_MOVE_DOWN
Move the anchor downwards e.g. |
static int |
ANCHOR_MOVE_LEFT
Move the anchor to the left e.g. |
static int |
ANCHOR_MOVE_RIGHT
Move the anchor to the right e.g. |
static int |
ANCHOR_MOVE_UP
Move the anchor upwards e.g. |
static int |
ANCHOR_POSITION_FLOATING
Position the anchor in the best position that will keep the callout window as much as possible on the screen when panning or zooming |
static int |
ANCHOR_POSITION_LEFT_MIDDLE
Position the anchor at the left center of the callout window |
static int |
ANCHOR_POSITION_LOWER_LEFT_CORNER
Position the anchor at the bottom left corner of the callout window |
static int |
ANCHOR_POSITION_LOWER_MIDDLE
Position the anchor at the bottom center of the callout window |
static int |
ANCHOR_POSITION_LOWER_RIGHT_CORNER
Position the anchor at the bottom right corner of the callout window |
static int |
ANCHOR_POSITION_RIGHT_MIDDLE
Position the anchor at the right center of the callout window |
static int |
ANCHOR_POSITION_UPPER_LEFT_CORNER
Position the anchor at the top left corner of the callout window |
static int |
ANCHOR_POSITION_UPPER_MIDDLE
Position the anchor at the top center of the callout window |
static int |
ANCHOR_POSITION_UPPER_RIGHT_CORNER
Position the anchor at the top right corner of the callout window |
| Constructor Summary | |
|---|---|
Callout(MapView map)
Constructor taking in the MapView the callout window will be displayed on as a parameter. |
|
| Method Summary | |
|---|---|
int |
getAnchor()
Returns the position of the anchor as one of the following possible values. |
Point |
getCoordinates()
Returns the map coordinates of the anchor point. |
int |
getMaxHeight()
Returns the maximum height the callout window can stretch to. |
int |
getMaxWidth()
Returns the maximum width the callout window can stretch to. |
int[] |
getOffset()
Returns an array of 2 integer values representing respectively the vertical and the horizontal offset of the anchor point relatively to the coordinates set for the anchor. |
void |
hide()
Hides the callout window. |
boolean |
isShowing()
Returns whether the callout is currently displayed or not. |
void |
move(Point newCoordinates)
Moves the callout window to the provided coordinates. |
void |
refresh()
This method invokes a refresh for the callout window when you need to refresh the contents because they have changed or been updated. |
void |
setAnchor(int anchor)
Assigns the position of the anchor using one of the following possible values: |
void |
setContent(android.view.View v)
Sets the content of the callout window. |
void |
setCoordinates(Point coordinates)
Sets the coordinates of the anchor points in the map spatial reference. |
void |
setMaxHeight(int maxHeight)
Sets the maximum height the callout window can stretch to. |
void |
setMaxWidth(int maxWidth)
Sets the maximum width the callout window can stretch to. |
void |
setOffset(int x,
int y)
Sets the vertical and the horizontal offset of the anchor point relatively to the coordinates set for the anchor. |
void |
setStyle(android.util.AttributeSet attrs)
Gives a set of attributes to be applied as the callout style |
void |
setStyle(int xmlId)
Sets the reference to the style of the callout window. |
void |
setTitle(String title)
Assigns a title to the callout window dialog that is displayed on the device. By default, the title is an empty String and will not display anything if this method is not invoked with a value. |
void |
show()
Displays the callout window with whatever parameters are set at the time of the method call. |
void |
show(Point coordinates)
Displays the callout window at the given coordinates with whatever parameters are set at the time of the method call. |
void |
show(Point coordinates,
android.view.View newContent)
Displays the callout window at the given coordinates with the provided content. |
void |
show(Point coordinates,
android.view.View newContent,
String newTitle)
Displays the callout window at the given coordinates with the provided content and title. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int ANCHOR_MOVE_DOWN
ANCHOR_POSITION_LEFT_MIDDLE to
ANCHOR_POSITION_LOWER_LEFT_CORNER
public static final int ANCHOR_MOVE_UP
ANCHOR_POSITION_LEFT_MIDDLE to
ANCHOR_POSITION_UPPER_LEFT_CORNER
public static final int ANCHOR_MOVE_LEFT
ANCHOR_POSITION_UPPER_RIGHT_CORNER to
ANCHOR_POSITION_UPPER_MIDDLE
public static final int ANCHOR_MOVE_RIGHT
ANCHOR_POSITION_LOWER_LEFT_CORNER to
ANCHOR_POSITION_LOWER_MIDDLE
public static final int ANCHOR_POSITION_UPPER_LEFT_CORNER
public static final int ANCHOR_POSITION_UPPER_MIDDLE
public static final int ANCHOR_POSITION_UPPER_RIGHT_CORNER
public static final int ANCHOR_POSITION_RIGHT_MIDDLE
public static final int ANCHOR_POSITION_LOWER_RIGHT_CORNER
public static final int ANCHOR_POSITION_LOWER_MIDDLE
public static final int ANCHOR_POSITION_LOWER_LEFT_CORNER
public static final int ANCHOR_POSITION_LEFT_MIDDLE
public static final int ANCHOR_POSITION_FLOATING
| Constructor Detail |
|---|
public Callout(MapView map)
MapView the callout window will be displayed on as a parameter.
map - the MapView this callout will display on.| Method Detail |
|---|
public Point getCoordinates()
public int getAnchor()
Returns the position of the anchor as one of the following possible values.
ANCHOR_POSITION_UPPER_LEFT_CORNERANCHOR_POSITION_UPPER_MIDDLEANCHOR_POSITION_UPPER_RIGHT_CORNERANCHOR_POSITION_RIGHT_MIDDLEANCHOR_POSITION_LOWER_RIGHT_CORNERANCHOR_POSITION_LOWER_MIDDLEANCHOR_POSITION_LOWER_LEFT_CORNERANCHOR_POSITION_LEFT_MIDDLEANCHOR_POSITION_FLOATING
public int getMaxWidth()
public int getMaxHeight()
public int[] getOffset()
public void setOffset(int x,
int y)
x - the vertical offset to sety - the horizontal offset to setpublic void setMaxWidth(int maxWidth)
maxWidth - the maximum width to set for the callout windowpublic void setMaxHeight(int maxHeight)
maxHeight - the maximum height to set for the callout windowpublic void setAnchor(int anchor)
Assigns the position of the anchor using one of the following possible values:
ANCHOR_POSITION_UPPER_LEFT_CORNERANCHOR_POSITION_UPPER_MIDDLEANCHOR_POSITION_UPPER_RIGHT_CORNERANCHOR_POSITION_RIGHT_MIDDLEANCHOR_POSITION_LOWER_RIGHT_CORNERANCHOR_POSITION_LOWER_MIDDLEANCHOR_POSITION_LOWER_LEFT_CORNERANCHOR_POSITION_LEFT_MIDDLEANCHOR_POSITION_FLOATING
anchor - the anchor position to setpublic void show()
public void show(Point coordinates)
coordinates - the coordinates of the anchor point
public void show(Point coordinates,
android.view.View newContent)
coordinates - the coordinates of the anchor pointnewContent - the content of the callout window
public void show(Point coordinates,
android.view.View newContent,
String newTitle)
coordinates - the coordinates of the anchor pointnewContent - the content of the callout windownewTitle - the title of the callout windowpublic void hide()
public void move(Point newCoordinates)
newCoordinates - the new coordinates of the anchor point of the callout windowpublic void setStyle(int xmlId)
xmlId - the android ID of the XML style for the callout windowpublic void setStyle(android.util.AttributeSet attrs)
attrs - public void setCoordinates(Point coordinates)
coordinates - the coordinates to setpublic void setContent(android.view.View v)
v - the view to be displayed in the callout windowpublic void setTitle(String title)
title - the title to set for the callout windowpublic boolean isShowing()
public void refresh()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||