MapMarker.TextStyle (API Reference)
Class MapMarker.TextStyle
- Enclosing class:
- MapMarker
Styling options for the text of a MapMarker.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDescribes a reason for failing to create aMapMarker.TextStyle.static final classThrown when a problem occurs while trying to create aMapMarker.TextStyleinstance.static enumRepresents text placement with respect to the icon of aMapMarker. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a default set of styling options for the text of aMapMarkerthat consists of the following values: Text size: 18 pixels Text color: opaque white Text outline size: 0 pixels Text outline color: opaque black Text placement:MapMarker.TextStyle.Placement.BOTTOMTextStyle(double textSize, Color textColor, double textOutlineSize, Color textOutlineColor, List<MapMarker.TextStyle.Placement> placements) Creates a set of styling options for the text of aMapMarker.TextStyle(double textSize, Color textColor, double textOutlineSize, Color textOutlineColor, List<MapMarker.TextStyle.Placement> placements, String fontName) Creates a set of styling options for the text of aMapMarker. -
Method Summary
Modifier and TypeMethodDescriptionGets the font name.Gets the possible text placements relative to the icon of aMapMarker.Gets the text color.Gets the text outline color.doubleGets the text outline size in pixels.doubleGets the text size in pixels.
-
Constructor Details
-
TextStyle
public TextStyle()Creates a default set of styling options for the text of a
MapMarkerthat consists of the following values:- Text size: 18 pixels
- Text color: opaque white
- Text outline size: 0 pixels
- Text outline color: opaque black
- Text placement:
MapMarker.TextStyle.Placement.BOTTOM
Once the resulting
TextStyleis applied to aMapMarker, its text will be centered over its image. The font will be 18 pixels wide, colored opaque white and will have no visible outline. -
TextStyle
public TextStyle(double textSize, @NonNull Color textColor, double textOutlineSize, @NonNull Color textOutlineColor, @NonNull List<MapMarker.TextStyle.Placement> placements) throws MapMarker.TextStyle.InstantiationException Creates a set of styling options for the text of a
MapMarker.List of placements is used to specify allowed placement of text relative to the icon. When marker overlapping is allowed as set by
MapMarker.setOverlapAllowed(boolean), only first placement element is considered. Otherwise the placement value is chosen so that the text does not overlap with otherMapMarkerinstances.Placement values are prioritized according to the order in which they appear in the list. Lists with duplicate entries as well as empty lists are not supported.
- Parameters:
textSize-The size of the text in pixels. Only positive values are supported.
textColor-The text color.
textOutlineSize-The size of the text outline in pixels. Only non-negative values are supported.
textOutlineColor-The color of the text outline.
placements-List of allowed placements of the text relative to the icon of a
MapMarker.- Throws:
MapMarker.TextStyle.InstantiationException-In case of invalid input parameters.
-
TextStyle
public TextStyle(double textSize, @NonNull Color textColor, double textOutlineSize, @NonNull Color textOutlineColor, @NonNull List<MapMarker.TextStyle.Placement> placements, @NonNull String fontName) throws MapMarker.TextStyle.InstantiationException Creates a set of styling options for the text of a
MapMarker.Note: This is a beta release of this feature, so there could be a few bugs and unexpected behavior. Related APIs may change for new releases without a deprecation process.
List of placements is used to specify allowed placement of text relative to the icon. When marker overlapping is allowed as set by
MapMarker.setOverlapAllowed(boolean), only first placement element is considered. Otherwise the placement value is chosen so that the text does not overlap with otherMapMarkerinstances.Placement values are prioritized according to the order in which they appear in the list. Lists with duplicate entries as well as empty lists are not supported.
- Parameters:
textSize-The size of the text in pixels. Only positive values are supported.
textColor-The text color.
textOutlineSize-The size of the text outline in pixels. Only non-negative values are supported.
textOutlineColor-The color of the text outline.
placements-List of allowed placements of the text relative to the icon of a
MapMarker.fontName-Font name, registered with
AssetsManager.registerFont. If empty string is provided, a default font will be used.- Throws:
MapMarker.TextStyle.InstantiationException-In case of invalid input parameters.
-
-
Method Details
-
getFontName
Gets the font name.
- Returns:
The font used in the text style.
-
getTextSize
public double getTextSize()Gets the text size in pixels.
- Returns:
The text size in pixels.
-
getTextColor
Gets the text color.
- Returns:
The text color.
-
getTextOutlineSize
public double getTextOutlineSize()Gets the text outline size in pixels.
- Returns:
The text outline size in pixels.
-
getTextOutlineColor
Gets the text outline color.
- Returns:
The text outline color.
-
getPlacements
Gets the possible text placements relative to the icon of a
MapMarker.- Returns:
List of possible text placements relative to the icon of a
MapMarker.
-