-
public final class IconGeneratorIconGenerator generates icons that contain text (or custom content) within an info window-like shape.
The icon Bitmaps generated by the factory should be used in conjunction with a com.google.android.gms.maps.model.BitmapDescriptorFactory.
This class is not thread safe.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classIconGenerator.Companion
-
Constructor Summary
Constructors Constructor Description IconGenerator(Context context)
-
Method Summary
Modifier and Type Method Description final BitmapmakeIcon(CharSequence text)Sets the text content, then creates an icon with the current style. final BitmapmakeIcon()Creates an icon with the current content and style. final UnitsetContentView(View contentView)Sets the child view for the icon. final UnitsetContentRotation(Integer degrees)Rotates the contents of the icon. final UnitsetRotation(Integer degrees)Rotates the icon. final FloatgetAnchorU()final FloatgetAnchorV()final UnitsetTextAppearance(Context context, Integer resid)Sets the text color, size, style, hint color, and highlight color from the specified TextAppearanceresource.final UnitsetTextAppearance(Integer resid)Sets the text color, size, style, hint color, and highlight color from the specified TextAppearanceresource.final UnitsetStyle(Integer style)Sets the style of the icon. final UnitsetColor(Integer color)Sets the background to the default, with a given color tint. final UnitsetBackground(Drawable background)Set the background to a given Drawable, or remove the background. final UnitsetContentPadding(Integer left, Integer top, Integer right, Integer bottom)Sets the padding of the content view. -
-
Constructor Detail
-
IconGenerator
IconGenerator(Context context)
-
-
Method Detail
-
makeIcon
final Bitmap makeIcon(CharSequence text)
Sets the text content, then creates an icon with the current style.
- Parameters:
text- the text content to display inside the icon.
-
makeIcon
final Bitmap makeIcon()
Creates an icon with the current content and style.
This method is useful if a custom view has previously been set, or if text content is not applicable.
-
setContentView
final Unit setContentView(View contentView)
Sets the child view for the icon.
If the view contains a TextView with the id "text", operations such as setTextAppearance and makeIcon will operate upon that TextView.
-
setContentRotation
final Unit setContentRotation(Integer degrees)
Rotates the contents of the icon.
- Parameters:
degrees- the amount the contents should be rotated, as a multiple of 90 degrees.
-
setRotation
final Unit setRotation(Integer degrees)
Rotates the icon.
- Parameters:
degrees- the amount the icon should be rotated, as a multiple of 90 degrees.
-
getAnchorU
final Float getAnchorU()
-
getAnchorV
final Float getAnchorV()
-
setTextAppearance
final Unit setTextAppearance(Context context, Integer resid)
Sets the text color, size, style, hint color, and highlight color from the specified
TextAppearanceresource.- Parameters:
resid- the identifier of the resource.
-
setTextAppearance
final Unit setTextAppearance(Integer resid)
Sets the text color, size, style, hint color, and highlight color from the specified
TextAppearanceresource.- Parameters:
resid- the identifier of the resource.
-
setStyle
final Unit setStyle(Integer style)
Sets the style of the icon. The style consists of a background and text appearance.
-
setColor
final Unit setColor(Integer color)
Sets the background to the default, with a given color tint.
- Parameters:
color- the color for the background tint.
-
setBackground
final Unit setBackground(Drawable background)
Set the background to a given Drawable, or remove the background.
- Parameters:
background- the Drawable to use as the background, or null to remove the background.
-
setContentPadding
final Unit setContentPadding(Integer left, Integer top, Integer right, Integer bottom)
Sets the padding of the content view. The default padding of the content view (i.e. text view) is 5dp top/bottom and 10dp left/right.
- Parameters:
left- the left padding in pixels.top- the top padding in pixels.right- the right padding in pixels.bottom- the bottom padding in pixels.
-
-
-
-