开发者

How can I remove the shadow on the markers on my map?

I am displaying a custom marker on my Google Map. They are placed fine, but they have this funny shadow. How can I remove the shadow?

How can I remove the shadow on the markers on my map?

@Override
        public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) {
            super.draw(canvas, mapView, shadow);

            // ---translate the GeoPoint to screen pixels---
            Point screenPts = new Point();
            mapView.getProjection().toPixels(geoPnt, screenPts);

      开发者_如何学Python      // ---add the marker---
            /*Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.pushpin);
            canvas.drawBitmap(bmp, screenPts.x, screenPts.y - 67, null);*/
            return true;
        }
    }


I'd try to pass false for the shadow parameter when invoking the overridden method.

That means it should look like super.draw(canvas, mapView, false).


Try this:

@Override
    public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) {
      if (!shadow) {
        super.draw(canvas, mapView, shadow);

        // ---translate the GeoPoint to screen pixels---
        Point screenPts = new Point();
        mapView.getProjection().toPixels(geoPnt, screenPts);

        // ---add the marker---
        Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.pushpin);
        canvas.drawBitmap(bmp, screenPts.x, screenPts.y - 67, null);
      }
      return true;
    }
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜