How to plot a pre-build map from google maps on a MapView

前端 未结 3 666
梦毁少年i
梦毁少年i 2021-01-23 17:00

I\'m trying to read a map from a link (http://maps.google.com/maps/ms?msid=216892338463540803496.000494dd57eb5ebce6db2&msa=0) and plot it on a MapView, is it possible?

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-23 17:43

    Look at this tutorial: http://codemagician.wordpress.com/2010/05/06/android-google-mapview-tutorial-done-right/

    @Override
     public void onCreate(Bundle savedInstanceState)
     {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.main);
    
     MapView mapView = (MapView) findViewById(R.id.mapview);
     mapView.setBuiltInZoomControls(true);
    
     List mapOverlays = mapView.getOverlays();
     Drawable drawable = this.getResources().getDrawable(R.drawable.icon);
     HelloItemizedOverlay itemizedoverlay = new HelloItemizedOverlay(drawable,this);
     GeoPoint point = new GeoPoint(30443769,-91158458);
     OverlayItem overlayitem = new OverlayItem(point, "Laissez les bon temps rouler!", "I'm in Louisiana!");
    
     GeoPoint point2 = new GeoPoint(17385812,78480667);
     OverlayItem overlayitem2 = new OverlayItem(point2, "Namashkaar!", "I'm in Hyderabad, India!");
    
     itemizedoverlay.addOverlay(overlayitem);
     itemizedoverlay.addOverlay(overlayitem2);
    
     mapOverlays.add(itemizedoverlay);
     }
     @Override
     protected boolean isRouteDisplayed()
     {
     return false;
     }
    }
    

提交回复
热议问题