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

发布于 2024-10-02 11:44:12 字数 706 浏览 4 评论 0原文

我正在我的 Google 地图上显示自定义标记。它们放置得很好,但它们有一个有趣的阴影。如何去除阴影?alt text

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

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?alt text

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

数理化全能战士 2024-10-09 11:44:12

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

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

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).

独闯女儿国 2024-10-09 11:44:12

试试这个:

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

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;
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文