繁体   English   中英

如何删除地图标记上的阴影?

[英]How can I remove the shadow on the markers on my map?

我正在Google地图上显示自定义标记。 它们放置得很好,但是它们有这个有趣的阴影。 如何去除阴影? 替代文字

@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);

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

在调用重写的方法时,我将尝试为shadow参数传递false

这意味着它应该看起来像super.draw(canvas, mapView, false)

尝试这个:

@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;
    }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM