如何在android上实现开放式街道地图,并在markers上实现infowindow?

OpenStreetMapTileProviderConstants.setUserAgentValue(BuildConfig.APPLICATION_ID);
        openStreetMap = (MapView)findViewById(R.id.openmapview);
        openStreetMap.setBuiltInZoomControls(true);
        openStreetMapController = openStreetMap.getController();
        openStreetMapController.setZoom(16);
        openStreetMap.setMultiTouchControls(true);

    GeoPoint initialLocation = new GeoPoint(lat , lng);
    centerMap(initialLocation);
    addLocation(lat ,lng , R.drawable.marker);}

这是我的代码,你想用它的信息窗口添加标记,比如googlemaps

最佳答案

最近添加了一个使用标记的示例。原始来源来自osmbonuspack's tutorial
样本位于here
基本代码是
GeoPoint startPoint = new GeoPoint(38.8977, -77.0365); //white house Marker startMarker = new Marker(mMapView); startMarker.setPosition(startPoint); startMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM); startMarker.setIcon(getResources().getDrawable(R.drawable.icon)); startMarker.setTitle("White House"); startMarker.setSnippet("The White House is the official residence and principal workplace of the President of the United States."); startMarker.setSubDescription("1600 Pennsylvania Ave NW, Washington, DC 20500"); mMapView.getOverlays().add(startMarker); mMapView.invalidate();

08-05 14:17