//// OSMdroid以标记为中心////
我添加标记,我需要以所有标记都可见的方式映射最大增加或减少
我的代码:
public class mapcode extends Activity {
globalvar appState;
int stats=0;
private MapView mapView;
private IMapController mapController;
private SimpleLocationOverlay mMyLocationOverlay;
private ScaleBarOverlay mScaleBarOverlay;
ItemizedIconOverlay<OverlayItem> currentLocationOverlay;
DefaultResourceProxyImpl resourceProxy;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.map);
appState = ((globalvar) getApplicationContext());
mapView = (MapView) this.findViewById(R.id.mapview);
mapView.setTileSource(TileSourceFactory.MAPNIK);
// mapView.setBuiltInZoomControls(true); //?????? ZOOM +-
mapView.setMultiTouchControls(true);
mapController = this.mapView.getController();
mapController.setZoom(2);
this.mMyLocationOverlay = new SimpleLocationOverlay(this);
this.mapView.getOverlays().add(mMyLocationOverlay);
this.mScaleBarOverlay = new ScaleBarOverlay(this);
this.mapView.getOverlays().add(mScaleBarOverlay);
// this.mapView
/////////////////
resourceProxy = new DefaultResourceProxyImpl(getApplicationContext());
GeoPoint currentLocation = new GeoPoint(55.860863,37.115046);
GeoPoint …Run Code Online (Sandbox Code Playgroud) 我使用asmdroid 4.2和bonuspack 4.5.
我的代码添加标记:
Marker startMarker = new Marker(mapView);
startMarker.setPosition(new GeoPoint(locationA,locationB));
startMarker.setIcon(getResources().getDrawable(drawable));
startMarker.setTitle("jkdfghspdifj");
startMarker.setAnchor(Marker.ANCHOR_CENTER, 1.0f);
MarkerInfoWindow infoWindow = new MyInfoWindow(R.layout.bonuspack_bubble,
mapView,title);
startMarker.setInfoWindow(infoWindow);
mapView.getOverlays().add(startMarker);
mapView.zoomToBoundingBox(boundingBox);
mapView.invalidate();
Run Code Online (Sandbox Code Playgroud)
一切正常:)
我点击标记并显示弹出窗口.当你点击卡片本身时如何做到这一点,标记消失了?(此刻它会消失,除非再次点击它)
osmdroid ×2