为什么在Android中放大或缩小时不显示群集标记图标

时间:2016-05-19 07:29:40

标签: android google-maps google-maps-api-3 markerclusterer

我正在尝试在我的地图上实现一个群集标记,首先,它向我展示了群集标记,但是当我放大,扩展并显示白色方块时,我会添加一些图像来更好地解释它。 / p>

images

public class MyItem implements ClusterItem {
        private final LatLng mPosition;
        String Title = "";
        int Icon;

        public MyItem(double lat, double lng, String title, int icon) {
            mPosition = new LatLng(lat, lng);
            Title = title;
            Icon = icon;
        }

        @Override
        public LatLng getPosition() {
            return mPosition;
        }

        public String getTitle() {
            return Title;
        }

        public int getIcon() {
            return Icon;
        }
    }
class OwnIconRendered extends DefaultClusterRenderer<MyItem> {


        public OwnIconRendered() {
            super(MapActivity.this, googleMap, mClusterManager);

        }

        @Override
        protected void onBeforeClusterItemRendered(MyItem item, MarkerOptions markerOptions) {
            markerOptions.icon(BitmapDescriptorFactory.fromResource(item.getIcon()));
            markerOptions.title(item.getTitle());
            super.onBeforeClusterItemRendered(item, markerOptions);
        }



        @Override
        protected void onBeforeClusterRendered(Cluster<MyItem> cluster, MarkerOptions markerOptions) {
            super.onBeforeClusterRendered(cluster, markerOptions);
        }

    }

1 个答案:

答案 0 :(得分:0)

关于gmaps-api问题已经打开了一个问题,请看这里:https://code.google.com/p/gmaps-api-issues/issues/detail?id=9765

另见:Google map marker is replaced by bounding rectangle on zoom

此处还介绍了一些解决方法。