嗨,我正在发出服务器请求,当我从服务器收到请求时,我正在Ui Thread上执行ClusterManager.addItem(),但是仅当我进行缩放更新(+,-)时,此项目才会在 map 上绘制正在显示。另外,我尝试调试渲染器,但是直到我更新 map 放大后,才会调用onBeforeClusterRendered / onBeforeClusterItemRendered。
有什么想法如何刷新map / clusterManager / markers吗?

        MarkerManager markerManager = new MarkerManager(map);
        clusterManager = new ClusterManager<TweetClusterItem>(getActivity(), map, markerManager);
        clusterManager.setRenderer(new TweetClusterRenderer(getActivity(), map, clusterManager, defaultMarker));
        clusterManager.setOnClusterClickListener(this);
        clusterManager.setOnClusterInfoWindowClickListener(this);
        clusterManager.setOnClusterItemClickListener(this);
        clusterManager.setOnClusterItemInfoWindowClickListener(this);

        UiSettings uiSettings = map.getUiSettings();
        uiSettings.setZoomControlsEnabled(true);
        uiSettings.setMyLocationButtonEnabled(false);

        map.setOnCameraChangeListener(clusterManager);
        map.setOnMarkerClickListener(clusterManager);
        map.setOnInfoWindowClickListener(clusterManager);
        map.setOnMapClickListener(this);

最佳答案

mClusterManager.cluster();

添加新项目后,强制重新聚类项目。

08-03 21:02