2015-07-13 14 views
2

Я использую карту Google для отображения местоположения автобусов, и я создал пользовательское окно Info, чтобы заменить маркер в карте Google, но я получаю его выше стандартного, как я могу отключить по умолчанию один? Возможно ли постоянно показывать информационные окна всех маркеров без необходимости касаться их?Google Map: отключить маркер по умолчанию

Я ценю любую помощь.

enter image description here

сильный текст

private boolean initMap() { 
     if (map == null) { 
      SupportMapFragment mapFrag = (SupportMapFragment) getSupportFragmentManager() 
        .findFragmentById(R.id.map); 
      map = mapFrag.getMap(); 
      // This part here to set the custom Info Window. 
      if (map != null) { 
       map.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() { 

        @Override 
        public View getInfoWindow(Marker arg0) { 
         return null; 
        } 

        @Override 
        public View getInfoContents(Marker marker) { 
         View v = getLayoutInflater().inflate(
           R.layout.info_window, null); 
         TextView tv_route_direct = (TextView) v 
           .findViewById(R.id.route_direct); 
         tv_route_direct.setText(marker.getTitle()); 
         return v; 
        } 
       }); 
      } 
     } 
     return (map != null); 
    } 

    private void gotoLocation(int id, double lat, double lng, 
      String route_direct) { 
     final float zoom = 11; 
     LatLng ll = null; 

     if (markerMap.containsKey(id)) { 
      // Update the location. 

      // To figure out which ones was not updated. 
      idList.add(id); 

      marker = markerMap.get(id); 
      // Remove from the map fragment. 
      marker.remove(); 
      // Remove from the HashMap tp add the new one. 
      markerMap.remove(id); 

      ll = new LatLng(lat, lng); 
      if (lat != 0 && lng != 0 && !route_direct.isEmpty()) { 

       MarkerOptions markerOpt = new MarkerOptions() 
         .title(route_direct).position(ll).visible(true); 
       marker = map.addMarker(markerOpt); 
       markerMap.put(id, marker); 

       CameraUpdate update = CameraUpdateFactory.newLatLngZoom(ll, 
         zoom); 
       map.moveCamera(update); 
       map.animateCamera(CameraUpdateFactory.zoomIn()); 
       map.animateCamera(CameraUpdateFactory.zoomTo(11), 2000, null); 
       System.out.println("test end of the update part."); 
      } 
} 
+0

Проверить эту: http://stackoverflow.com/questions/14811579/android -map-апи-v2-пользовательский маркер-с-ImageView –

ответ

0

Попробуйте это:

marker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.UrMarkerIcon)); 
Смежные вопросы