2013-01-14 24 views

cevap

16

Evet. OnInfoWindowClickListener iç

//mMap is an instance of GoogleMap 
mMap.setOnInfoWindowClickListener(getInfoWindowClickListener()); 

Geçersiz kıl onInfoWindowClicked() yöntemi:

public OnInfoWindowClickListener getInfoWindowClickListener() 
{ 
    return new OnInfoWindowClickListener() 
    {  
     @Override 
     public void onInfoWindowClick(Marker marker) 
     { 
      Toast.makeText(getApplicationContext(), "Clicked a window with title..." + marker.getTitle(), Toast.LENGTH_SHORT).show(); 
     } 
    };  
} 

Ve seçilen işaretleyici takip seçildiği işaretleyici belirlemek için

, sizin GoogleMap bir OnInfoWindowClickedListener eklemek Belki de bir örnek değişkeniyle.

//markerList is just a list keeping track of all the markers you've added 
//to the map so far, which means you'll have to add each marker to this 
//list as you put it on the map 
Marker marker = this.markerList.get(someObjectYoureShowingAMarkerFor.getId()); 

if(marker != null) 
{ 
    marker.showInfoWindow(); 
} 
+0

Sadece ihtiyacım olan şey, teşekkürler! – noisecapella

1

Sen kullanabilirsiniz:

ardından, tüm belirteçlerin bir listesini tutmak birinde ele almak ve buna benzer showInfoWindow(), aramak gerekecek, programlı bir işaret seçmek için OnMarkerClickListener.

googleMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() { 
     @Override 
     public boolean onMarkerClick(Marker marker) { 
      Toast.makeText(getApplicationContext(), "Clicked a marker with title..." + marker.getTitle(), Toast.LENGTH_SHORT).show(); 
      return true; 
     } 
    }); 
İlgili konular