2013-05-19 63 views
0

我在地圖上成功添加了多個標記。使用showInfoWindow僅顯示最後添加的標記的標題。那麼是否有辦法一次顯示所有標記的標題? 謝謝:)在地圖上顯示多個標記標題

+0

可以請您詳細闡述您的問題,以便其他能明白什麼是您的具體要求。因爲我明白你的問題showInfoWindow只顯示最後添加標記的標題?谷歌地圖將顯示您選擇的特定標記的信息對話框,但不顯示其他信息對話框。 – Maulik

回答

2

這是不可能直接顯示所有信息窗口。

我會建議使用自定義標記圖標和畫布來繪製您的文字上方可能看起來像信息窗口的標記。

+0

完美,但你有什麼想法我怎麼能實現這樣的事情? –

+0

我有一些可以幫助你的代碼。它在標記圖像上繪製數字:[DemoIconProvider.java](http://code.google.com/p/android-maps-extensions/source/browse/android-maps-extensions-demo/src/pl/mg6/android /maps/extensions/demo/DemoIconProvider.java)。 –

0

AFAIK這是Google Map API V2的功能,在任何給定的時間只顯示一個InfoWindow

1
LinearLayout tv = (LinearLayout) this.getLayoutInflater().inflate(R.layout.marker_dialog, null, false); 
tv.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), 
        View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); 
tv.layout(0, 0, tv.getMeasuredWidth(), tv.getMeasuredHeight()); 

tv.setDrawingCacheEnabled(true); 
tv.buildDrawingCache(); 
Bitmap bm = tv.getDrawingCache(); 

LatLng latLng = new LatLng(latitudemy, longitudemy); 

BitmapDescriptor icon = BitmapDescriptorFactory.fromBitmap(bm); 

BitmapDescriptorFactory.fromResource(R.mipmap.ic_launcher); 
map.addMarker(new MarkerOptions().position(new LatLng(latitudemy, longitudemy)).title("origin").snippet("Srivastava").icon(icon)); 
// Showing the current location in Google Map 
map.addMarker(new MarkerOptions().position(new LatLng(latitude, longitude)).title("destination").snippet("Srivastava").icon(icon)); 
+0

使用圖像視圖和文本視圖定義您的custum佈局以顯示圖像和地點或人物的名稱...在marker_dialog上方佈局 – Shikhar