我们可以在同一个 Android 地图视图中拥有不同类型的标记吗?
看看这个屏幕截图
我想知道如何在同一个 Android 地图视图中添加不同类型的标记?因为我们必须使用 5nt 可绘制对象创建一个覆盖列表,并且以后无法更改此可绘制对象(标记)。
List<Overlay> mapOverlays = mapView.getOverlays();
Drawable drawable = Activity.this.getResources().getDrawable(R.drawable.icon);
MyItemizedOverlay itemizedOverlay = new MyItemizedOverlay(drawable ,Activity.this);
GeoPoint point = new GeoPoint( (int)(location.getLatitude()*1000000),
(int)(location.getLongitude()*1000000));
OverlayItem overlayitem = new OverlayItem(point, "Current Location :","+acTextView.getText());
itemizedOverlay.addOverlay(overlayitem);
mapOverlays.add(itemizedOverlay);
MapController mapController = mapView.getController();
mapController.animateTo(point);
mapController.setZoom(14);
Take a look at this screenshot
I wonder how can we add different kind of marker in the same Android mapview? Because we must create a list of overlays with fivent drawable, and cannot change this drawable (marker) later.
List<Overlay> mapOverlays = mapView.getOverlays();
Drawable drawable = Activity.this.getResources().getDrawable(R.drawable.icon);
MyItemizedOverlay itemizedOverlay = new MyItemizedOverlay(drawable ,Activity.this);
GeoPoint point = new GeoPoint( (int)(location.getLatitude()*1000000),
(int)(location.getLongitude()*1000000));
OverlayItem overlayitem = new OverlayItem(point, "Current Location :","+acTextView.getText());
itemizedOverlay.addOverlay(overlayitem);
mapOverlays.add(itemizedOverlay);
MapController mapController = mapView.getController();
mapController.animateTo(point);
mapController.setZoom(14);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
至少您可以定义多个叠加层,每个叠加层都有自己的标记。不?
你也可以重写 ItemizedOveralay.draw
At least you can define more than one overlay, each one with its own marker. No?
And also you can override ItemizedOveralay.draw