开发者

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

Change Marker icon depending on state correctly?

). The glow of the marker is the effect I wish to achieve. As per the code above, it is generated via two layered Drawables, namely (for instance)

Change Marker icon depending on state correctly?

and

Change Marker icon depending on state correctly?

.

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 :

Change Marker icon depending on state correctly?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜