是否有可能没有影子使用OverlayItem.setMarker()? [英] Is it possible to use OverlayItem.setMarker() with no shadow?
问题描述
我想在我的地图上显示不同的标记。一个解决方案,我能找到的定义每个标记的新的覆盖。但后来我发现,这是可以做到的更容易
OverlayItme.set标记(标记可绘制);
块引用>使用单一覆盖。它工作正常,但标记与阴影绘制的,我想,没有阴影,以显示标记图标,我的原画已经没影了,我要画它,因为它是。可能吗?
这是我怎么现在做的:markerpic = this.getResources()getDrawable(R.drawable.icon_map)。
markerpic.setBounds(0,0,markerpic.getIntrinsicWidth(),markerpic.getIntrinsicHeight()); GP的GeoPoint =新的GeoPoint((INT)(LAT * 1E6),(INT)(LNG * 1E6)); overlayitem =新OverlayItem(GP,标题,消息);
overlayitem.setMarker(markerpic);
myoverlay.adOverlay(overlayitem);
mapOverlay.add(myoverlay);
解决方案我创建延伸ItemizedOverlay一个子类
在我的类中重写此去除阴影:公共无效画(油画画布,MapView类MapView类,布尔阴影)
{
如果(!影)
{
super.draw(画布,MapView类,FALSE);
}
}I want to display different markers on my map. One solution I could find is to define a new overlay for each marker. But then I could find that it can be done easier with
OverlayItme.set Marker(Drawable marker);
using a single overlay. It works fine, but the markers are drawn with shadow and I would like to display the marker icon with no shadow, my original picture has no shadow, and I want to draw it as it is. is it possible? This is how I'm doing now:
markerpic = this.getResources().getDrawable(R.drawable.icon_map); markerpic.setBounds(0, 0, markerpic.getIntrinsicWidth(), markerpic.getIntrinsicHeight()); GeoPoint gp = new GeoPoint((int)(lat*1E6), (int)(lng*1E6)); overlayitem = new OverlayItem(gp, "Title", "Message"); overlayitem.setMarker(markerpic); myoverlay.adOverlay(overlayitem); mapOverlay.add(myoverlay);
解决方案I have created a subclass which extends ItemizedOverlay and override this in my class for removing the shadow:
public void draw(Canvas canvas, MapView mapView, boolean shadow) { if(!shadow) { super.draw(canvas, mapView, false); } }
这篇关于是否有可能没有影子使用OverlayItem.setMarker()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!