Why cluster marker icon not showing when zoom in or zoom out in android [duplicate]

两盒软妹~` 提交于 2019-12-08 13:25:23

问题


I'm trying to implement a cluster marker on my map,first, it shows me the cluster marker but when i zoom in, that expand and also show white square, i'll add some images to explain it better.

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:


There is an opened issue on gmaps-api-issues, look here: https://code.google.com/p/gmaps-api-issues/issues/detail?id=9765

Also look here: Google map marker is replaced by bounding rectangle on zoom

Some workarounds are also described there.



来源:https://stackoverflow.com/questions/37316636/why-cluster-marker-icon-not-showing-when-zoom-in-or-zoom-out-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!