Class TextSymbol
- java.lang.Object
- 
- com.esri.arcgisruntime.symbology.Symbol
- 
- com.esri.arcgisruntime.symbology.MarkerSymbol
- 
- com.esri.arcgisruntime.symbology.TextSymbol
 
 
 
- 
- All Implemented Interfaces:
- JsonSerializable
 
 public final class TextSymbol extends MarkerSymbol Defines how text is displayed, describing the appearance and positioning of the text.Text symbols are used to display text for graphics. The graphics can be based on any type of geometry - point, multipoint, polyline, or polygon. Setting the angle of a TextSymbol using MarkerSymbol.setAngle(float)only applies when working with 2D maps and will not work in 3D scenes.- Since:
- 100.0.0
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classTextSymbol.FontDecorationDefines various decorations that can be applied to the text of this Symbol.static classTextSymbol.FontStyleDefines various styles that can be applied to the text of this Symbol.static classTextSymbol.FontWeightDefines how thick or thin the characters in text appear.static classTextSymbol.HorizontalAlignmentDefines horizontal alignment of the text within the Symbol.static classTextSymbol.VerticalAlignmentDefines vertical alignment of the text within the Symbol.- 
Nested classes/interfaces inherited from class com.esri.arcgisruntime.symbology.MarkerSymbolMarkerSymbol.AngleAlignment
 
- 
 - 
Constructor SummaryConstructors Constructor Description TextSymbol()Creates a new TextSymbol with default values.TextSymbol(float size, String text, int color, TextSymbol.HorizontalAlignment hAlign, TextSymbol.VerticalAlignment vAlign)Creates a new TextSymbol with the given size, text, and color along with the horizontal and vertical alignment relative to the mid-point of this Symbol.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetBackgroundColor()Gets the background color of this TextSymbol as an ARGB(alpha, red, green, blue) color value.intgetColor()Gets the color of this TextSymbol as an ARGB(alpha, red, green, blue) color value.TextSymbol.FontDecorationgetFontDecoration()Gets the decoration being used by this Symbol's text.StringgetFontFamily()Gets the FontFamily being used by this Symbol's text.TextSymbol.FontStylegetFontStyle()Gets the FontStyle of the text that is being used by this Symbol.TextSymbol.FontWeightgetFontWeight()Gets the FontWeight of the text being displayed by this Symbol.intgetHaloColor()Gets the halo color as an ARGB(alpha, red, green, blue) color value.floatgetHaloWidth()Gets the width of the halo in density-independent pixels (dp).TextSymbol.HorizontalAlignmentgetHorizontalAlignment()Gets the horizontal alignment of the text relative to the Symbol's mid-point location.intgetOutlineColor()Gets the outline color as an ARGB(alpha, red, green, blue) color value.floatgetOutlineWidth()Gets the width of the outline in density-independent pixels (dp).floatgetSize()Gets the Symbol's text size in density-independent pixels (dp).StringgetText()Gets the text displayed by this Symbol.TextSymbol.VerticalAlignmentgetVerticalAlignment()Gets the vertical alignment of the text relative to the Symbol's mid-point location.voidsetBackgroundColor(int color)Sets the background color of this TextSymbol using an ARGB(alpha, red, green, blue) color value.voidsetColor(int color)Sets the color of this TextSymbol using an ARGB(alpha, red, green, blue) color value.voidsetFontDecoration(TextSymbol.FontDecoration fontDecoration)Sets the decoration for the text being used by this Symbol.voidsetFontFamily(String fontFamily)Sets the FontFamily for the text being used by this Symbol.voidsetFontStyle(TextSymbol.FontStyle fontStyle)Sets the FontStyle for the text that is being used by this Symbol.voidsetFontWeight(TextSymbol.FontWeight fontWeight)Sets the FontWeight for the text that is being used by this Symbol.voidsetHaloColor(int haloColor)Sets the halo color using an ARGB(alpha, red, green, blue) color value.voidsetHaloWidth(float haloWidth)Sets the width of the halo in density-independent pixels (dp).voidsetHorizontalAlignment(TextSymbol.HorizontalAlignment horizontalAlignment)Sets the horizontal alignment of the text relative to the Symbol's mid-point location.voidsetOutlineColor(int outlineColor)Sets the outline color using an ARGB(alpha, red, green, blue) color value.voidsetOutlineWidth(float outlineWidth)Sets the width of the outline in density-independent pixels (dp).voidsetSize(float size)Sets the size of the text in density-independent pixels (dp).voidsetText(String text)Sets the text displayed by this Symbol.voidsetVerticalAlignment(TextSymbol.VerticalAlignment verticalAlignment)Sets the vertical alignment of the text relative to the Symbol's mid-point location.- 
Methods inherited from class com.esri.arcgisruntime.symbology.MarkerSymbolgetAngle, getAngleAlignment, getLeaderOffsetX, getLeaderOffsetY, getOffsetX, getOffsetY, getRotationType, setAngle, setAngleAlignment, setLeaderOffsetX, setLeaderOffsetY, setOffsetX, setOffsetY, setRotationType
 - 
Methods inherited from class com.esri.arcgisruntime.symbology.SymbolcreateSwatchAsync, createSwatchAsync, createSwatchAsync, createSwatchAsync, createSwatchAsync, fromJson, getUnknownJson, getUnsupportedJson, toJson
 
- 
 
- 
- 
- 
Constructor Detail- 
TextSymbolpublic TextSymbol() Creates a new TextSymbol with default values.The default values are: - Color, black
- Size, 8.0
- FontStyle, TextSymbol.FontStyle.NORMAL
- FontWeight, TextSymbol.FontWeight.NORMAL
- HorizontalAlignment, TextSymbol.HorizontalAlignment.CENTER
- VerticalAlignment, TextSymbol.VerticalAlignment.MIDDLE
- FontDecoration, TextSymbol.FontDecoration.NONE
 - Since:
- 100.0.0
 
 - 
TextSymbolpublic TextSymbol(float size, String text, int color, TextSymbol.HorizontalAlignment hAlign, TextSymbol.VerticalAlignment vAlign)Creates a new TextSymbol with the given size, text, and color along with the horizontal and vertical alignment relative to the mid-point of this Symbol.- Parameters:
- text- the text to be displayed for the associated graphic
- color- an integer representing the text color as 0xAARRGGBB
- size- the size of the Symbol's text
- hAlign- the horizontal alignment of the Symbol's text
- vAlign- the vertical alignment of the Symbol's text
- Throws:
- IllegalArgumentException- if text is null
- IllegalArgumentException- if hAlign is null
- IllegalArgumentException- if vAlign is null
- Since:
- 100.0.0
 
 
- 
 - 
Method Detail- 
getBackgroundColorpublic int getBackgroundColor() Gets the background color of this TextSymbol as an ARGB(alpha, red, green, blue) color value.Default value is 0x00000000. - Returns:
- an integer representing the text background color as 0xAARRGGBB
- Since:
- 100.4.0
- See Also:
- Color
 
 - 
setBackgroundColorpublic void setBackgroundColor(int color) Sets the background color of this TextSymbol using an ARGB(alpha, red, green, blue) color value.ARGB integer color values range from 0x00000000 to 0xFFFFFFFF with each pair of hex values representing either the alpha, red, green, or blue channels. For the alpha channel, a value of 00 means fully transparent and a value of FF is opaque. - Parameters:
- color- an integer representing the text background color using the form 0xAARRGGBB
- Since:
- 100.4.0
 
 - 
getColorpublic int getColor() Gets the color of this TextSymbol as an ARGB(alpha, red, green, blue) color value.Default value is black, 0xFF000000. - Returns:
- an integer representing the text color as 0xAARRGGBB
- Since:
- 100.0.0
- See Also:
- setColor(int)
 
 - 
setColorpublic void setColor(int color) Sets the color of this TextSymbol using an ARGB(alpha, red, green, blue) color value.ARGB integer color values range from 0x00000000 to 0xFFFFFFFF with each pair of hex values representing either the alpha, red, green, or blue channels. For the alpha channel, a value of 00 means fully transparent and a value of FF is opaque. - Parameters:
- color- an integer representing the text color using the form 0xAARRGGBB
- Since:
- 100.0.0
 
 - 
getFontDecorationpublic TextSymbol.FontDecoration getFontDecoration() Gets the decoration being used by this Symbol's text.Default value is NONE. - Returns:
- the font decoration of this symbol's text
- Since:
- 100.0.0
- See Also:
- setFontDecoration(com.esri.arcgisruntime.symbology.TextSymbol.FontDecoration)
 
 - 
setFontDecorationpublic void setFontDecoration(TextSymbol.FontDecoration fontDecoration) Sets the decoration for the text being used by this Symbol.FontDecoration adds effects on top of the text. - Parameters:
- fontDecoration- the new font decoration for this Symbol's text
- Throws:
- IllegalArgumentException- if input is null
- Since:
- 100.0.0
- See Also:
- setFontDecoration(com.esri.arcgisruntime.symbology.TextSymbol.FontDecoration)
 
 - 
getFontFamilypublic String getFontFamily() Gets the FontFamily being used by this Symbol's text.Default value is an empty string. - Returns:
- the font family the Symbol's text
- Since:
- 100.0.0
- See Also:
- setFontFamily(java.lang.String)
 
 - 
setFontFamilypublic void setFontFamily(String fontFamily) Sets the FontFamily for the text being used by this Symbol. This can be as specific as 'arial' or as generic as 'sans-serif'.- Parameters:
- fontFamily- the new font family for this Symbol's text
- Since:
- 100.0.0
 
 - 
getFontStylepublic TextSymbol.FontStyle getFontStyle() Gets the FontStyle of the text that is being used by this Symbol.Default value is NORMAL. - Returns:
- the font style the Symbol's text
- Since:
- 100.0.0
- See Also:
- setFontStyle(com.esri.arcgisruntime.symbology.TextSymbol.FontStyle)
 
 - 
setFontStylepublic void setFontStyle(TextSymbol.FontStyle fontStyle) Sets the FontStyle for the text that is being used by this Symbol.A FontStyle changes the appearance of text by leaning the text. - Parameters:
- fontStyle- the new font style for this Symbol's text
- Throws:
- IllegalArgumentException- if input is null
- Since:
- 100.0.0
 
 - 
getFontWeightpublic TextSymbol.FontWeight getFontWeight() Gets the FontWeight of the text being displayed by this Symbol.Default value is NORMAL. - Returns:
- the font weight being used by this Symbol's text
- Since:
- 100.0.0
- See Also:
- setFontWeight(com.esri.arcgisruntime.symbology.TextSymbol.FontWeight)
 
 - 
setFontWeightpublic void setFontWeight(TextSymbol.FontWeight fontWeight) Sets the FontWeight for the text that is being used by this Symbol.Font weight describes how thick or thin characters in text are displayed. - Parameters:
- fontWeight- the new font weight for this Symbol's text
- Throws:
- IllegalArgumentException- if input is null @since 100.0.0
 
 - 
getSizepublic float getSize() Gets the Symbol's text size in density-independent pixels (dp).Default value is 8.0. - Returns:
- the size of the Symbol's text in dp
- Since:
- 100.0.0
 
 - 
setSizepublic void setSize(float size) Sets the size of the text in density-independent pixels (dp).Setting the size of the text to 0.0 will cause the text not to be displayed. - Parameters:
- size- the new size of this Symbol's text in dp, greater than 0.0 to be visible
- Throws:
- ArcGISRuntimeException- if size less than 0.0
- Since:
- 100.0.0
 
 - 
getTextpublic String getText() Gets the text displayed by this Symbol.Default value is an empty string. - Returns:
- the text of this Symbol
- Since:
- 100.0.0
- See Also:
- setText(java.lang.String)
 
 - 
setTextpublic void setText(String text) Sets the text displayed by this Symbol.The alignment of the text has to do with the positioning of the text in relation to the mid-point of this Symbol. - Parameters:
- text- the new text for this Symbol
- Since:
- 100.0.0
- See Also:
- setHorizontalAlignment(com.esri.arcgisruntime.symbology.TextSymbol.HorizontalAlignment),- setVerticalAlignment(com.esri.arcgisruntime.symbology.TextSymbol.VerticalAlignment)
 
 - 
getVerticalAlignmentpublic TextSymbol.VerticalAlignment getVerticalAlignment() Gets the vertical alignment of the text relative to the Symbol's mid-point location.Default value is MIDDLE. - Returns:
- the vertical alignment of the Symbol's text
- Since:
- 100.0.0
- See Also:
- getVerticalAlignment()
 
 - 
setVerticalAlignmentpublic void setVerticalAlignment(TextSymbol.VerticalAlignment verticalAlignment) Sets the vertical alignment of the text relative to the Symbol's mid-point location.- Parameters:
- verticalAlignment- the new vertical alignment for the Symbol's text
- Throws:
- IllegalArgumentException- if input is null
- Since:
- 100.0.0
- See Also:
- TextSymbol.VerticalAlignment
 
 - 
getHorizontalAlignmentpublic TextSymbol.HorizontalAlignment getHorizontalAlignment() Gets the horizontal alignment of the text relative to the Symbol's mid-point location.Default value is CENTER. - Returns:
- the horizontal alignment of the Symbol's text
- Since:
- 100.0.0
- See Also:
- getHorizontalAlignment()
 
 - 
setHorizontalAlignmentpublic void setHorizontalAlignment(TextSymbol.HorizontalAlignment horizontalAlignment) Sets the horizontal alignment of the text relative to the Symbol's mid-point location.- Parameters:
- horizontalAlignment- the new horizontal alignment for the Symbol's text
- Throws:
- IllegalArgumentException- if input is null
- Since:
- 100.0.0
- See Also:
- TextSymbol.HorizontalAlignment
 
 - 
getHaloColorpublic int getHaloColor() Gets the halo color as an ARGB(alpha, red, green, blue) color value.Default value is transparent. - Returns:
- an integer representing the halo color as 0xAARRGGBB
- Since:
- 100.0.0
- See Also:
- setHaloColor(int)
 
 - 
setHaloColorpublic void setHaloColor(int haloColor) Sets the halo color using an ARGB(alpha, red, green, blue) color value.Halo displays a color along the outside border of a letter. ARGB integer color values range from 0x00000000 to 0xFFFFFFFF with each pair of hex values representing either the alpha, red, green, or blue channels. For the alpha channel, a value of 00 means fully transparent and a value of FF is opaque. - Parameters:
- haloColor- an integer representing the halo color using the form 0xAARRGGBB
- Since:
- 100.0.0
- See Also:
- getHaloColor()
 
 - 
getHaloWidthpublic float getHaloWidth() Gets the width of the halo in density-independent pixels (dp).Default value is 0.0. - Returns:
- the width of the halo in density-independent pixels (dp)
- Since:
- 100.0.0
- See Also:
- setHaloWidth(float)
 
 - 
setHaloWidthpublic void setHaloWidth(float haloWidth) Sets the width of the halo in density-independent pixels (dp).Setting to 0.0 will cause the halo not to be displayed. - Parameters:
- haloWidth- the new width of the halo in density-independent pixels (dp)
- Throws:
- ArcGISRuntimeException- if haloWidth less than 0.0
- Since:
- 100.0.0
- See Also:
- getHaloWidth()
 
 - 
getOutlineColorpublic int getOutlineColor() Gets the outline color as an ARGB(alpha, red, green, blue) color value.Default value is transparent. - Returns:
- an integer representing the halo color as 0xAARRGGBB
- Since:
- 100.0.0
- See Also:
- setOutlineColor(int)
 
 - 
setOutlineColorpublic void setOutlineColor(int outlineColor) Sets the outline color using an ARGB(alpha, red, green, blue) color value.Outline displays a color along the inside border of a letter. ARGB integer color values range from 0x00000000 to 0xFFFFFFFF with each pair of hex values representing either the alpha, red, green, or blue channels. For the alpha channel, a value of 00 means fully transparent and a value of FF is opaque. - Parameters:
- outlineColor- an integer representing the outline color using the form 0xAARRGGBB
- Since:
- 100.0.0
- See Also:
- getOutlineColor()
 
 - 
getOutlineWidthpublic float getOutlineWidth() Gets the width of the outline in density-independent pixels (dp).Default value is 0.0. - Returns:
- the width of the outline in density-independent pixels (dp)
- Since:
- 100.0.0
- See Also:
- setOutlineWidth(float)
 
 - 
setOutlineWidthpublic void setOutlineWidth(float outlineWidth) Sets the width of the outline in density-independent pixels (dp).Setting to 0.0 will cause the outline not to be displayed. - Parameters:
- outlineWidth- the new width of the outline in density-independent pixels (dp)
- Throws:
- ArcGISRuntimeException- if outlineWidth less than 0.0
- Since:
- 100.0.0
- See Also:
- getOutlineWidth()
 
 
- 
 
-