【发布时间】:2016-06-13 19:51:15
【问题描述】:
我一直在尝试更改我的 KML 的样式,以便用我选择的自定义标记来表示 KmlPoint。
这是我正在使用的标记:
我成功地用相应的标记显示了想要的点,但它们看起来像是可能应用了颜色过滤器,或者位图只是损坏了,我不知道为什么。
这是我的代码:
KmlDocument dryKmlDocument = new KmlDocument();
File f2 = new File(appPath + "/dry_hydrant.kml");
dryKmlDocument.parseKMLFile(f2);
Bitmap blueBitmap = ((BitmapDrawable)ResourcesCompat.getDrawable(getResources(), R.drawable.blue, null)).getBitmap();
Style dryStyle = new Style(blueBitmap, 0x901010AA, 1.0f, 0x20AA1010);
ZoneStyler dryZoneStyler = new ZoneStyler(dryStyle, dryKmlDocument, osmView);
dryKmlOverlay = (FolderOverlay)dryKmlDocument.mKmlRoot.buildOverlay(osmView, null, dryZoneStyler, dryKmlDocument);
KmlDocument fireKmlDocument = new KmlDocument();
File f3 = new File(appPath + "/fire_hydrant.kml");
fireKmlDocument.parseKMLFile(f3);
Bitmap redBitmap = ((BitmapDrawable)ResourcesCompat.getDrawable(getResources(), R.drawable.red, null)).getBitmap();
Style fireStyle = new Style(redBitmap, 0x00000000, 1.0f, 0x00000000);
ZoneStyler fireZoneStyler = new ZoneStyler(fireStyle, fireKmlDocument, osmView);
fireKmlOverlay = (FolderOverlay)fireKmlDocument.mKmlRoot.buildOverlay(osmView, null, fireZoneStyler, fireKmlDocument);
有人能指出是什么原因造成的吗?
编辑:Imgur 不想显示我的 bmp 标记图像,所以我在 Windows 资源管理器中截取了屏幕截图。
【问题讨论】:
-
使用 png 格式。并确保角落是完全透明的(你不能用 Windows 画图做到这一点,你需要像 IcoFX、Gimp、PhotoShop 之类的东西......)。
-
@MKer 我使用 GIMP 来实现透明度,下周我会尝试 .png 格式,如果有问题再回来。
-
@MKer 是的,你是对的!不支持 .bmp 图像。如果您可以更改您的评论以获得答案,我们将不胜感激,我们可以将此问题标记为已回答。
-
如果您愿意,可以为评论“投票”。
-
当然可以,但我无法将问题标记为已从评论中回答。如果您不想回答,我将创建一个社区 wiki。 :P