views:

33

answers:

0

I am putting several markers on a MapView by subclassing an ItemizedOverlay. The hitch is that the marker I am passing to the ItemizedOverlay is a custom Drawable. That is to say, I've subclassed "Drawable" and I have overwritten the draw() method. The point of this was to add a color filter to the Drawable, and add custom text:

public void draw(Canvas canvas) {
    String[] colorComps = color.split(",");
    baseDrawable.mutate().setColorFilter(Color.rgb(Integer.valueOf(colorComps[0]),
                                                   Integer.valueOf(colorComps[1]),
                                                   Integer.valueOf(colorComps[2])),
                                         PorterDuff.Mode.MULTIPLY);
    baseDrawable.draw(canvas);

    Paint textPaint = new Paint();
    textPaint.setTextAlign(Paint.Align.CENTER);
    textPaint.setColor(Color.WHITE);
    textPaint.setAntiAlias(true);
    textPaint.setTextSize(12);
    textPaint.setTypeface(Typeface.DEFAULT);
    int textX = getIntrinsicWidth()/2 - 1 + baseDrawable.getBounds().left;
    int textY = getIntrinsicHeight()/2 + baseDrawable.getBounds().top;
    canvas.drawText(ID, textX, textY, textPaint);
}

The problem is that when I do this, the shadow on the MapView is not the simple grey, translucent overlay that it should be. Rather, the color filter and text is applied to the shadow as well. Any suggestions on how to avoid this problem?