2011-08-17 118 views

回答

3

正如你在我以前的答案發布的詳細信息(」 但我不想解析KML和逐點繪圖,我想知道是否有一種方法可以一次全部繪出「),我現在可以重新編寫我的答案。

你應該嘗試這些線路,並根據需要進行修改:

Intent mapIntent = new Intent(Intent.ACTION_VIEW); 
Uri uri1 = Uri.parse("geo:0,0?q=http://code.google.com/apis/kml/ 
documentation/KML_Samples.kml"); 
mapIntent.setData(uri1); 
startActivity(Intent.createChooser(mapIntent, "Sample")); 

不幸的是,你不會有任何控制,因爲這不是一個MapActivity。 如果您打算在地圖上添加更多內容,您必須嘗試我的第一個提議並解析自己的kml!

類似的問題:How to use kml file on mapView in Android

0

您可以在本教程在地圖上繪製Overlays

+0

但有可能繪製所有地圖點一次,或者我應該分析繪製一個接一個的KML? –

+0

是的,你可以繪製一個覆蓋 –

0

看: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<Overlay> 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; 
} 
} 
+0

多個圖像,但我不想分析KML和逐點繪製。我想知道是否有一種方法來一次繪製所有圖案 –

+0

也許你的問題值得超過3行......當你問一個問題時,你應該真的描述你的需求,我們不能猜測你在想什麼;-) –