问题描述
所有,
我有一个需要显示在一个图形页面对象的信息。有没有问题。
I have a need to display information on a MapView object. No problems there.
问题是,有些时候的MapView对象显示地图信息在视觉上我的叠加数据的竞争。
The issue is that there are times when the MapView object displays map details that visually compete with my overlay data.
所以,我想要做的是提供一种方法来缩减的MapView对象视觉上使用Alpha通道。
So, what I'd like to do is provide a way to "scale back" the MapView object visually by using an alpha channel.
粗体*的可以Alpha值得到应用到MapView的对象呢?如果是这样,怎么样?的*粗体
bold*Can an alpha value get applied to a MapView object? If so, how?*bold
另外,我在想,也许是一个独立的全黑覆盖可以提供相同的结果。这个规模覆盖的alpha,我可能最终得到相同的整体效果。
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.
洞察吧。
感谢。
富
推荐答案
您确定要这么做吗?它可能会更好重新审视您的覆盖的图形设计......只是给他们一个较厚的边框可能是一个廉价的解决问题的办法。
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.
第一个建议是将继承图形窗口和覆盖dispatchDraw()像这样的东西:
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
}
这篇关于如何使MapView的对象透明(阿尔法)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!