2010-09-20 67 views
0

朋友,如何在谷歌地圖上的android顯示多色地圖疊加層或引腳?

現在我使用的顯示在谷歌地圖地圖疊加的列表下面的代碼

mapOverlays = mapView.getOverlays(); 
     drawable = this.getResources().getDrawable(R.drawable.balloon); 
     itemizedOverlay = new MarkerItemizedOverlay(drawable,this); 

     GeoPoint point; 
     OverlayItem overlayitem; 
     for (DalMapSearch t : Sr) 
     { 
      if(t != null) 
      { 
      point = new GeoPoint((int) (t.getLati() * 1E6), (int) (t.getLongi() * 1E6)); 
      overlayitem = new OverlayItem(point, heading, t.getAd_text()+", "+t.getLocation()+"@@"+t.getAd_id()); 
      itemizedOverlay.addOverlay(overlayitem); 
      } 

     } 
     mapOverlays.add(itemizedOverlay); 


     // marker code goes here 

     mc.animateTo(myLocation); 

     mc.setZoom(12); 
     mapView.invalidate(); 

所以在這種情況下氣球顯示我想顯示在類別太depened其它圖片或if語句。 任何人指導我如何顯示不同的圖像作爲地圖疊加?例如圖像是imageA,ImageB,ImageC

任何幫助,將不勝感激。

回答

1

GeoPoint point = new GeoPoint(lat.intValue(),lng.intValue());

drawable = this.getResources().getDrawable(R.drawable.marker); 
    itemizedOverlay = new MyItemizedOverlay(drawable); 
    OverlayItem overlayItem = new OverlayItem(point, "", ""); 
    itemizedOverlay.addOverlay(overlayItem); 
    mapOverlays.add(itemizedOverlay); 


    GeoPoint point2 = new GeoPoint(lt2.intValue(),long2.intValue()); 
    // All "B"s 
    drawable = this.getResources().getDrawable(R.drawable.icon); 
    itemizedOverlay = new MyItemizedOverlay(drawable); 
    OverlayItem overlayItem1 = new OverlayItem(point2, "", ""); 
    itemizedOverlay.addOverlay(overlayItem1); 
    mapOverlays.add(itemizedOverlay); 
+0

@ UMAR:Nice answer .. +1 – 2012-02-10 10:35:51

相關問題