public static final class

Callout.Style

extends Object
java.lang.Object
   ↳ com.esri.arcgisruntime.mapping.view.Callout.Style

Class Overview

Encapsulates a set of parameters that control how a callout looks. There are two alternative ways to construct a CalloutStyle object and set its contents:

  • Use the Style(Context) constructor and then call setter methods to set any parameters that require non-default values.
  • Use the Style(Context, int) constructor and provide an XML file in the res/xml folder of the application. The XML must contain a <calloutStyle> element with a number of optional attributes as described below.

The parameters and their default values are shown below. This also gives the attribute names to use in the XML file if the latter option above is used.

XML Attribute Description Default Value
backgroundColor Background color of the callout. In XML this may be a color value or a reference to a color resource, for example "#FF0000" (RRGGBB) or "#FF808080" (AARRGGBB) or "@android:color/white". White
borderColor Color of the border of the callout. In XML this may be a color value or a reference to a color resource, for example "#FF0000" or "@android:color/black". Black
borderWidth Width of the border of the callout in density-independent pixels. 2
cornerRadius Radius of curvature of the corners of the callout in density-independent pixels. 10
maxHeight Maximum height of the callout in density-independent pixels. Full height of the MapView
maxWidth Maximum width of the callout in density-independent pixels. Full width of the MapView
minHeight Minimum height of the callout in density-independent pixels. Just sufficient to draw border and corners
minWidth Minimum width of the callout in density-independent pixels. Just sufficient to draw border and corners
leaderPosition Position style of the leader of the callout. See Callout.Style.LeaderPosition. LOWER_MIDDLE
leaderLength Length of the leader of the callout in density-independent pixels. 12
leaderWidth Width of the leader of the callout in density-independent pixels. 12

Here's an example XML file:

  <?xml version="1.0" encoding="utf-8"?>
  <resources>
      <calloutStyle
          backgroundColor="#FFC0C0C0" // opaque gray
          borderColor="@android:color/white"
          borderWidth="4"
          cornerRadius="20"
          maxHeight="500"
          maxWidth="500"
          minHeight="100"
          minWidth="200"
          leaderPosition="AUTOMATIC"
          leaderLength="10"
          leaderWidth="20"
      />
  </resources>
 

Summary

Nested Classes
enum Callout.Style.LeaderPosition Indicates the side or corner of a callout on which the leader is drawn. 
Public Constructors
Style(Context context)
Constructor that sets all parameters to their default values.
Style(Context context, int xmlResourceId)
Constructor taking the resource ID for an XML document.
Public Methods
int getBackgroundColor()
Gets the background color.
int getBorderColor()
Gets the border color.
int getBorderWidth()
Gets the border width.
int getCornerRadius()
Gets the corner curve radius.
int getLeaderLength()
Gets the leader length.
Callout.Style.LeaderPosition getLeaderPosition()
Gets the position of the leader relative to the body of the callout.
int getLeaderWidth()
Gets the leader width where it joins the body of the callout.
int getMaxHeight()
Gets the maximum height of the callout.
int getMaxWidth()
Gets the maximum width of the callout.
int getMinHeight()
Gets the minimum height of the callout.
int getMinWidth()
Gets the minimum width of the callout.
void setBackgroundColor(int backgroundColor)
Sets the background color.
void setBorderColor(int borderColor)
Sets the border color.
void setBorderWidth(int borderWidth)
Sets the border width.
void setCornerRadius(int cornerRadius)
Sets the corner curve radius.
void setLeaderLength(int leaderLength)
Sets the leader length.
void setLeaderPosition(Callout.Style.LeaderPosition leaderPosition)
Sets the position of the leader relative to the body of the callout.
void setLeaderWidth(int leaderWidth)
Sets the leader width where it joins the body of the callout.
void setMaxHeight(int maxHeight)
Sets the maximum height of the callout.
void setMaxWidth(int maxWidth)
Sets the maximum width of the callout.
void setMinHeight(int minHeight)
Sets the minimum height of the callout.
void setMinWidth(int minWidth)
Sets the minimum width of the callout.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Style (Context context)

Constructor that sets all parameters to their default values. See Callout.Style for default values.

Parameters
context the current execution Context

public Style (Context context, int xmlResourceId)

Constructor taking the resource ID for an XML document. Any parameters not included in the XML document will take default values as specified in Callout.Style.

Parameters
context the current execution Context
xmlResourceId the Android ID of an XML file in the res/xml folder of the application. The XML must contain a <calloutStyle> element, otherwise default values will be used for all parameters.

Public Methods

public int getBackgroundColor ()

Gets the background color. By default this is white (0xFFFFFFFF).

Returns
  • the background color as 0xAARRGGBB

public int getBorderColor ()

Gets the border color. By default this is black (0xFF000000).

Returns
  • the border color as 0xAARRGGBB

public int getBorderWidth ()

Gets the border width.

Returns
  • the border width in density-independent pixels

public int getCornerRadius ()

Gets the corner curve radius.

Returns
  • the corner curve radius in density-independent pixels

public int getLeaderLength ()

Gets the leader length.

Returns
  • the leader length in density-independent pixels

public Callout.Style.LeaderPosition getLeaderPosition ()

Gets the position of the leader relative to the body of the callout.

Returns
  • the position of the leader

public int getLeaderWidth ()

Gets the leader width where it joins the body of the callout.

Returns
  • the leader width in density-independent pixels

public int getMaxHeight ()

Gets the maximum height of the callout.

Returns
  • the maximum height of the callout window in density-independent pixels, or 0 if none has been set

public int getMaxWidth ()

Gets the maximum width of the callout.

Returns
  • the maximum width of the callout window in density-independent pixels, or 0 if none has been set

public int getMinHeight ()

Gets the minimum height of the callout. This is just sufficient to draw border and corners, unless a greater value has been set.

Returns
  • the minimum height of the callout window in density-independent pixels

public int getMinWidth ()

Gets the minimum width of the callout. This is just sufficient to draw border and corners, unless a greater value has been set.

Returns
  • the minimum width of the callout window in density-independent pixels

public void setBackgroundColor (int backgroundColor)

Sets the background color.

Parameters
backgroundColor the background color as 0xAARRGGBB

public void setBorderColor (int borderColor)

Sets the border color.

Parameters
borderColor the border color as 0xAARRGGBB

public void setBorderWidth (int borderWidth)

Sets the border width. By default this is 2 density-independent pixels.

Parameters
borderWidth the border width in density-independent pixels

public void setCornerRadius (int cornerRadius)

Sets the corner curve radius. By default this is 10 density-independent pixels.

Parameters
cornerRadius the corner curve radius in density-independent pixels

public void setLeaderLength (int leaderLength)

Sets the leader length. By default this is 12 density-independent pixels.

Parameters
leaderLength the leader length in density-independent pixels

public void setLeaderPosition (Callout.Style.LeaderPosition leaderPosition)

Sets the position of the leader relative to the body of the callout. By default this is LOWER_MIDDLE.

Parameters
leaderPosition the position of the leader

public void setLeaderWidth (int leaderWidth)

Sets the leader width where it joins the body of the callout. By default this is 12 density-independent pixels.

Parameters
leaderWidth the leader width in density-independent pixels

public void setMaxHeight (int maxHeight)

Sets the maximum height of the callout. By default it will stretch to accommodate the content that is to appear inside it, limited only by the height of the MapView.

Parameters
maxHeight the maximum height of the callout in density-independent pixels

public void setMaxWidth (int maxWidth)

Sets the maximum width of the callout. By default it will stretch to accommodate the content that is to appear inside it, limited only by the width of the MapView.

Parameters
maxWidth the maximum width of the callout in density-independent pixels

public void setMinHeight (int minHeight)

Sets the minimum height of the callout. By default it will be just sufficient to draw border and corners.

Parameters
minHeight the minimum height of the callout in density-independent pixels

public void setMinWidth (int minWidth)

Sets the minimum width of the callout. By default it will be just sufficient to draw border and corners.

Parameters
minWidth the minimum width of the callout in density-independent pixels