Issue on removing item from clustermanager

前端 未结 5 449
鱼传尺愫
鱼传尺愫 2020-12-16 01:44

In my Android application, I have to delete and re-add a cluster item in my GoogleMap, that represents my current location. But when I run this code:

cluster         


        
5条回答
  •  时光说笑
    2020-12-16 02:00

    By default ClusterManager uses NonHierarchicalDistanceBasedAlgorithm, that doesn't implement removing elements.

    Try to use GridBasedAlgorithm instead (it supports elements remove):

    clusterMng.setAlgorithm(new GridBasedAlgorithm());
    

    Or, for better performance, wrap it with PreCachingAlgorithmDecorator, as ClusterManager does by default:

    clusterMng.setAlgorithm(new PreCachingAlgorithmDecorator(new GridBasedAlgorithm()));
    

提交回复
热议问题