1

기본적으로 InfoWindowAdapter를 사용하는 사용자 정의 InfoWindow를 열려고합니다. 나는지도가로드 된 직후를 의미합니다. 이것이 가능한가? 그렇다면 어떻게?Android에서 사용자 정의 Infowindows 열기 Google maps v2

나는 다음과 같습니다

googleMap.setInfoWindowAdapter(new CustomInfoWindowAdapter()); 
    final Marker mark = googleMap.addMarker(new MarkerOptions().position(latLong) 
        .title("Last Updated:")); 
     markers.put(mark.getId(), url); 

내 사용자 정의 정보 창 어댑터

private class CustomInfoWindowAdapter implements InfoWindowAdapter 
{ 

    private View view; 

    public CustomInfoWindowAdapter() { 
     view = getLayoutInflater().inflate(R.layout.custom_info_window, 
       null); 
    } 

    @Override 
    public View getInfoContents(Marker marker) { 

     if (MainActivity.this.marker != null 
       && MainActivity.this.marker.isInfoWindowShown()) { 
      MainActivity.this.marker.hideInfoWindow(); 
      MainActivity.this.marker.showInfoWindow(); 
     } 
     return null; 
    } 

    @Override 
    public View getInfoWindow(final Marker marker) 
    { 
     MainActivity.this.marker = marker; 

     String url = null; 

     if (marker.getId() != null && markers != null && markers.size() > 0) { 
      if (markers.get(marker.getId()) != null && 
        markers.get(marker.getId()) != null) { 
       url = markers.get(marker.getId()); 
      } 
     } 
     final ImageView image = ((ImageView) view.findViewById(R.id.badge)); 

     if (url != null && !url.equalsIgnoreCase("null") 
       && !url.equalsIgnoreCase("")) { 
      imageLoader.displayImage(url, image, options, 
        new SimpleImageLoadingListener() { 
         @Override 
         public void onLoadingComplete(String imageUri, 
           View view, Bitmap loadedImage) { 
          super.onLoadingComplete(imageUri, view, 
            loadedImage); 
          getInfoContents(marker); 
         } 
        }); 
     } else { 
      image.setImageResource(R.drawable.ic_launcher); 
     } 

     final String title = marker.getTitle(); 
     final TextView titleUi = ((TextView) view.findViewById(R.id.title)); 
     if (title != null) { 
      titleUi.setText(title); 
     } else { 
      titleUi.setText(""); 
     } 

     final String snippet = marker.getSnippet(); 
     final TextView snippetUi = ((TextView) view 
       .findViewById(R.id.snippet)); 
     if (snippet != null) { 
      snippetUi.setText(snippet); 
     } else { 
      snippetUi.setText(""); 
     } 

     return view; 
    } 
} 

위는 핀을 나타 나는 창 정보를 클릭합니다. 맞춤형 정보창을 자동으로 표시하고 싶습니다.

감사합니다.

답변

관련 문제