【问题标题】:multiple info window on MAPMAP 上的多个信息窗口
【发布时间】:2013-04-29 04:17:38
【问题描述】:

我正在开发一个主要使用 Google MAP API 的 android 应用程序。 目前,google MAP api 只允许标记上的单个信息窗口。我需要在地图上的所有标记上放置文本或图像,并同时显示所有信息窗口。

有人知道我们该怎么做吗?

【问题讨论】:

  • 你得到答案了吗?我需要和你一样的功能我仍然找不到解决方案。

标签: android api google-maps infowindow


【解决方案1】:

我想你可能已经得到了答案。因为我的回答会对其他人有所帮助。

您需要创建自己的InfoWindowAdapter 以在 infoWindow 中显示多个信息。

setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {

        // Use default InfoWindow frame 
        @Override 
        public View getInfoWindow(Marker arg0) {
            return null; 
        } 

        // Defines the contents of the InfoWindow 
        @Override 
        public View getInfoContents(Marker marker) {

            // Getting view from the layout file info_window_layout 
            View v = getActivity().getLayoutInflater().inflate(R.layout.maps_infowindow, null);
            v.setLayoutParams(new LinearLayout.LayoutParams((int) (mapFragment.getView().getMeasuredWidth() * .9), LinearLayout.LayoutParams.WRAP_CONTENT));
            ((TextView) v.findViewById(R.id.title)).setText(marker.getTitle());
            ((TextView) v.findViewById(R.id.desc)).setText(marker.getSnippet());
            ImageView markerIcon = (ImageView) v.findViewById(R.id.imageView5);
            markerIcon.setImageResource(R.mipmap.back_vision_fade); 
            return v;

        }
    });

【讨论】:

    猜你喜欢
    • 2018-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-15
    • 1970-01-01
    • 2012-10-16
    • 1970-01-01
    相关资源
    最近更新 更多