2015-06-19 81 views
1

我有一個標記與信息窗口。我怎樣才能從地圖上移除那個綠色的手指?看看這個:如何刪除標記圖標

enter image description here

我的代碼:

Marker startMarker = new Marker(mapView); 
startMarker.setPosition(gPt);  
startMarker.setIcon(null);//doesn't help 
startMarker.setAnchor(Marker.ANCHOR_CENTER, 1.0f); 
InfoWindow infoWindow = new MyInfoWindow(R.layout.bonuspack_bubble, 
     mapView, company); 
startMarker.setInfoWindow(infoWindow); 
startMarker.setTitle(company.getName()); 
startMarker.showInfoWindow();   
mapView.getOverlays().add(startMarker); 
+1

替換透明一個 –

+0

標記圖標參閱[此](http://stackoverflow.com/a/20031319/1479511) – NarendraJi

回答

1

試試這個代碼

mapView.getOverlays().remove(startMarker); 
mapView.invalidate(); 
+0

沒有明確'()'方法 – Tony

+1

調用MapView.getOverlays()。除去(startMarker); mapView.invalidate(); – sasikumar

+1

我想擺脫綠色手指,而不是標記。如果我刪除標記,地圖不會顯示我的信息窗口可能 – Tony

2

瞭解你想要顯示的信息窗口,但沒有任何標記圖標:替換默認「綠色手指」標記由一個小透明圖標表示。

  • 小(1x1像素),以便您的InfoWindow粘貼到gPt位置。
  • 透明,讓用戶什麼都看不到。

    startMarker.setIcon(mySmallTransparentIcon);

+0

應該是被接受的答案:) –