如何使 MapView 对象透明(alpha)?

发布于 2024-09-28 11:24:51 字数 317 浏览 1 评论 0原文

所有,

我需要在 MapView 对象上显示信息。那里没有问题。

问题是,有时 MapView 对象显示的地图详细信息在视觉上与我的叠加数据相竞争。

因此,我想做的是提供一种通过使用 alpha 通道在视觉上“缩小”MapView 对象的方法。

alpha 值可以应用于 MapView 对象吗?如果是这样,怎么做?

或者,我在想也许单独的全黑覆盖可以提供相同的结果。缩放此叠加层的 Alpha,我可能最终会得到相同的整体效果。

请有见识。

谢谢。

富有的

All,

I have a need to display information on a MapView object. No problems there.

The issue is that there are times when the MapView object displays map details that visually compete with my overlay data.

So, what I'd like to do is provide a way to "scale back" the MapView object visually by using an alpha channel.

Can an alpha value get applied to a MapView object? If so, how?

Alternatively, I was thinking that perhaps a separate all black overlay might provide the same results. Scale the alpha of this overlay and I might end up with the same overall effect.

Insight please.

Thanks.

Rich

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

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

发布评论

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

评论(1

送君千里 2024-10-05 11:24:51

您确定要这样做吗?重新审视覆盖层的图形设计可能会更好……简单地给它们加粗边框可能是解决问题的廉价方法。

第一个建议是子类化 MapView 并使用如下内容重写dispatchDraw():

@Override protected void dispatchDraw(Canvas canvas) {

  // Firstly let MapView draw
  super.dispatchDraw(canvas);

  // Draw a translucent fill on top of it
  canvas.drawColor(0x7FFFFFFF);

  // TODO: Draw my overlay
}

Are you sure you want to do this? It might be better to revisit your overlay's graphic design... simply giving them a thicker border might be a cheap solution to the problem.

First suggestion would be to subclass MapView and override dispatchDraw() with something like this:

@Override protected void dispatchDraw(Canvas canvas) {

  // Firstly let MapView draw
  super.dispatchDraw(canvas);

  // Draw a translucent fill on top of it
  canvas.drawColor(0x7FFFFFFF);

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