public class IconGenerator
extends java.lang.Object
The icon Bitmap
s generated by the factory should be used in conjunction with a com.google.android.gms.maps.model.BitmapDescriptorFactory
.
This class is not thread safe.
Modifier and Type | Field and Description |
---|---|
static int |
STYLE_BLUE |
static int |
STYLE_DEFAULT |
static int |
STYLE_GREEN |
static int |
STYLE_ORANGE |
static int |
STYLE_PURPLE |
static int |
STYLE_RED |
static int |
STYLE_WHITE |
Constructor and Description |
---|
IconGenerator(android.content.Context context)
Creates a new IconGenerator with the default style.
|
Modifier and Type | Method and Description |
---|---|
float |
getAnchorU() |
float |
getAnchorV() |
android.graphics.Bitmap |
makeIcon()
Creates an icon with the current content and style.
|
android.graphics.Bitmap |
makeIcon(java.lang.CharSequence text)
Sets the text content, then creates an icon with the current style.
|
void |
setBackground(android.graphics.drawable.Drawable background)
Set the background to a given Drawable, or remove the background.
|
void |
setColor(int color)
Sets the background to the default, with a given color tint.
|
void |
setContentPadding(int left,
int top,
int right,
int bottom)
Sets the padding of the content view.
|
void |
setContentRotation(int degrees)
Rotates the contents of the icon.
|
void |
setContentView(android.view.View contentView)
Sets the child view for the icon.
|
void |
setRotation(int degrees)
Rotates the icon.
|
void |
setStyle(int style)
Sets the style of the icon.
|
void |
setTextAppearance(android.content.Context context,
int resid)
Sets the text color, size, style, hint color, and highlight color from the specified
TextAppearance resource. |
void |
setTextAppearance(int resid)
Sets the text color, size, style, hint color, and highlight color from the specified
TextAppearance resource. |
public static final int STYLE_DEFAULT
public static final int STYLE_WHITE
public static final int STYLE_RED
public static final int STYLE_BLUE
public static final int STYLE_GREEN
public static final int STYLE_PURPLE
public static final int STYLE_ORANGE
public IconGenerator(android.content.Context context)
public android.graphics.Bitmap makeIcon(java.lang.CharSequence text)
text
- the text content to display inside the icon.public android.graphics.Bitmap makeIcon()
This method is useful if a custom view has previously been set, or if text content is not applicable.
public void setContentView(android.view.View contentView)
If the view contains a TextView
with the id "text", operations such as setTextAppearance(android.content.Context, int)
and makeIcon(CharSequence)
will operate upon that TextView
.
public void setContentRotation(int degrees)
degrees
- the amount the contents should be rotated, as a multiple of 90 degrees.public void setRotation(int degrees)
degrees
- the amount the icon should be rotated, as a multiple of 90 degrees.public float getAnchorU()
public float getAnchorV()
public void setTextAppearance(android.content.Context context, int resid)
TextAppearance
resource.resid
- the identifier of the resource.public void setTextAppearance(int resid)
TextAppearance
resource.resid
- the identifier of the resource.public void setStyle(int style)
public void setColor(int color)
color
- the color for the background tint.public void setBackground(android.graphics.drawable.Drawable background)
background
- the Drawable to use as the background, or null to remove the background.public void setContentPadding(int left, int top, int right, int bottom)
left
- the left padding in pixels.top
- the top padding in pixels.right
- the right padding in pixels.bottom
- the bottom padding in pixels.