-
public 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 .
This class is not thread safe.
-
-
Field Summary
Fields Modifier and Type Field Description public final static intSTYLE_DEFAULTpublic final static intSTYLE_WHITEpublic final static intSTYLE_REDpublic final static intSTYLE_BLUEpublic final static intSTYLE_GREENpublic final static intSTYLE_PURPLEpublic final static intSTYLE_ORANGE
-
Constructor Summary
Constructors Constructor Description IconGenerator(Context context)Creates a new IconGenerator with the default style.
-
Method Summary
Modifier and Type Method Description BitmapmakeIcon(CharSequence text)Sets the text content, then creates an icon with the current style. BitmapmakeIcon()Creates an icon with the current content and style. voidsetContentView(View contentView)Sets the child view for the icon. voidsetContentRotation(int degrees)Rotates the contents of the icon. voidsetRotation(int degrees)Rotates the icon. floatgetAnchorU()floatgetAnchorV()voidsetTextAppearance(Context context, int resid)Sets the text color, size, style, hint color, and highlight color from the specified TextAppearanceresource.voidsetTextAppearance(int resid)Sets the text color, size, style, hint color, and highlight color from the specified TextAppearanceresource.voidsetStyle(int style)Sets the style of the icon. voidsetColor(int color)Sets the background to the default, with a given color tint. voidsetBackground(Drawable background)Set the background to a given Drawable, or remove the background. voidsetContentPadding(int left, int top, int right, int bottom)Sets the padding of the content view. -
-
Constructor Detail
-
IconGenerator
IconGenerator(Context context)
Creates a new IconGenerator with the default style.
-
-
Method Detail
-
makeIcon
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
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 notapplicable.
-
setContentView
void setContentView(View contentView)
-
setContentRotation
void setContentRotation(int degrees)
Rotates the contents of the icon.
- Parameters:
degrees- the amount the contents should be rotated, as a multiple of 90 degrees.
-
setRotation
void setRotation(int degrees)
Rotates the icon.
- Parameters:
degrees- the amount the icon should be rotated, as a multiple of 90 degrees.
-
getAnchorU
float getAnchorU()
-
getAnchorV
float getAnchorV()
-
setTextAppearance
void setTextAppearance(Context context, int resid)
Sets the text color, size, style, hint color, and highlight color from the specified
TextAppearanceresource.- Parameters:
resid- the identifier of the resource.
-
setTextAppearance
void setTextAppearance(int resid)
Sets the text color, size, style, hint color, and highlight color from the specified
TextAppearanceresource.- Parameters:
resid- the identifier of the resource.
-
setStyle
void setStyle(int style)
Sets the style of the icon. The style consists of a background and text appearance.
-
setColor
void setColor(int color)
Sets the background to the default, with a given color tint.
- Parameters:
color- the color for the background tint.
-
setBackground
void 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
void setContentPadding(int left, int top, int right, int bottom)
Sets the padding of the content view. The default padding of the content view (i.e. textview) 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.
-
-
-
-