|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.esri.android.map.Callout
public class Callout
The CalloutView class draws a callout window and manages its behavior. 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).
When the anchor position is set to ANCHOR_POSITION_FLOATING
, the callout window will automatically adjust
itself to try to remain on the device's screen when panning. Use the CalloutStyle.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 convert
screen pixels to map coordinates, or to obtain the spatial coordinate system used by the MapView, as needed.
The callout's 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:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<calloutViewStyle
titleTextColor="#000000" <!-- some RGB color or a reference to a color />
titleTextSize = 10; <!-- size of the title text in scaled pixels (based on screen density and user font size preference) />
titleTextStyle = 0; <!-- See the class Typeface in the Android SDK for available values />
titleTextTypeFace = 0; <!-- See the class Typeface in the Android SDK for available values />
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 />
style.getCornerCurve()="0" <!-- the radius of the window's corners' curvature (max=40) />
anchor="5" /> <!-- the position of the anchor (0-8, 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">
Field Summary | |
---|---|
static int |
ANCHOR_POSITION_FLOATING
Positions 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
Positions the anchor at the left center of the callout window |
static int |
ANCHOR_POSITION_LOWER_LEFT_CORNER
Positions the anchor at the bottom left corner of the callout window |
static int |
ANCHOR_POSITION_LOWER_MIDDLE
Positions the anchor at the bottom center of the callout window |
static int |
ANCHOR_POSITION_LOWER_RIGHT_CORNER
Positions the anchor at the bottom right corner of the callout window |
static int |
ANCHOR_POSITION_RIGHT_MIDDLE
Positions the anchor at the right center of the callout window |
static int |
ANCHOR_POSITION_UPPER_LEFT_CORNER
Positions the anchor at the top left corner of the callout window |
static int |
ANCHOR_POSITION_UPPER_MIDDLE
Positions the anchor at the top center of the callout window |
static int |
ANCHOR_POSITION_UPPER_RIGHT_CORNER
Positions the anchor at the top right corner of the callout window |
Constructor Summary | |
---|---|
Callout(MapView map)
Constructor taking in MapView on which the callout window will be displayed. |
Method Summary | |
---|---|
void |
animatedHide()
Hides the callout window with animation. |
void |
animatedShow(Point coordinates,
android.view.View newContent)
Displays the callout window with animation at the given coordinates with the provided content. |
Point |
getCoordinates()
Returns the map coordinates of the anchor point. |
int |
getMaxHeight()
Returns the maximum height the callout window can stretch. |
int |
getMaxWidth()
Returns the maximum width the callout window can stretch. |
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. |
CalloutStyle |
getStyle()
Returns the style of current callout. |
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 refreshes the content of the callout window for the content's change or update. |
void |
setContent(android.view.View v)
Sets the content of the callout window to display in callout window. |
void |
setCoordinates(Point coordinates)
Sets the anchor of the callout window to the given point 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(CalloutStyle style)
Sts the style of the callout |
void |
setStyle(int xmlId)
Sets the style of the callout window from an XML resource id. |
void |
show()
Displays the callout window. |
void |
show(Point coordinates)
Displays the callout window at the given point in the spatial reference of map view. |
void |
show(Point coordinates,
android.view.View newContent)
Displays the callout window at the given point with the provided content. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
on which the callout window will be displayed.
map
- the MapView
on which this callout will display.Method Detail |
---|
public Point getCoordinates()
public int getMaxWidth()
public int getMaxHeight()
public int[] getOffset()
public CalloutStyle getStyle()
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 show()
public void show(Point coordinates)
coordinates
- the coordinates of the anchor pointpublic void show(Point coordinates, android.view.View newContent)
coordinates
- the point of the anchornewContent
- the content of the callout windowpublic void animatedShow(Point coordinates, android.view.View newContent)
coordinates
- the coordinates of the anchor pointnewContent
- the content of the callout windowpublic void hide()
public void animatedHide()
public void move(Point newCoordinates)
newCoordinates
- the new coordinates of the anchor point of the callout windowpublic void setStyle(int xmlId)
Sets the style of the callout window from an XML resource id.
xmlId
- the android ID of the XML style for the callout windowpublic void setStyle(CalloutStyle style)
style
- public void setCoordinates(Point coordinates)
coordinates
- of the point the anchor is to setpublic void setContent(android.view.View v)
v
- the view to display in the callout windowpublic boolean isShowing()
public void refresh()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |