Change Marker icon depending on state correctly?
I am able to draw a Marker based upon a state (e.g. a field within my extended OverlayItem
class) using the following code :
@Override
public Drawable getMarker(int pStateBitset)
{
Drawable currentMarker = super.getMarker(pStateBitset);
Drawable[] toDrawLayers;
if (mSelected)
{
BitmapDrawable overlay = (BitmapDrawable) mSELECTED_OVERLAY;
overlay.setAntiAlias(true);
toDrawLayers = new Drawable[] { currentMarker, overlay };开发者_如何学运维
}
else
{
toDrawLayers = new Drawable[] { currentMarker };
}
return new LayerDrawable(toDrawLayers);
}
This works as expected (drawing a marker such as
). The glow of the marker is the effect I wish to achieve. As per the code above, it is generated via two layeredDrawable
s, namely (for instance) and .
I had to ensure that the size of the glow is the same as the normal marker image, so that the resulting Drawable
doesn't rescale (marker image size is 32x37 px).
However, what I am aiming for is in fact a bigger glow (that would, indeed yield a bigger image), such as :
How can I render a drawable which yields a bigger glow (thus using an image which is indeed bigger than the normal marker image) and does not result in a scaled / resized normal marker ? Is that feasable ?
Thanks in advance, I can provide any additional details if necessary.
Use a different marker image. Here is a sample project showing changing the marker image based on user input.
精彩评论