0
我在我的應用程序中使用標記羣集。我想增加網格大小。我已經定製了DefaultClusterRenderer類,但是我沒有找到任何增加尺寸的東西。請幫我解決如何增加它。 以下是定製clusterRenderer的代碼如何在android中增加Marker Cluster的網格大小?
public class MyClusterRenderer extends DefaultClusterRenderer<MyItem> {
public MyClusterRenderer(Context context, GoogleMap map, ClusterManager clusterManager) {
super(context, map, clusterManager);
}
@Override
protected boolean shouldRenderAsCluster(Cluster<MyItem> cluster) {
//start clustering if at least 2 items overlap
return cluster.getSize() > 4;
}
@Override
protected void onBeforeClusterItemRendered(MyItem item,MarkerOptions markerOptions){
if(item.isRegister()==true)
{
BitmapDescriptor markerDescriptor = BitmapDescriptorFactory.defaultMarker(340);
markerOptions.icon(markerDescriptor);
//markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.x));
}
else if(item.isRegister()==false)
{
BitmapDescriptor markerDescriptor = BitmapDescriptorFactory.defaultMarker(60);
markerOptions.icon(markerDescriptor).title("false");
}
}
}
您可能能夠使用這些答案的組合http://stackoverflow.com/questions/23338772/maps-api-v3-clustering-at-different-zoom-levels/23341368#23341368,HTTP ://stackoverflow.com/questions/15700808/setting-max-zoom-level-in-google-maps-android-api-v2,和http://stackoverflow.com/questions/16331940/create-adaptive-grid- on-the-map-for-clusterization – Verma
@Verma謝謝,提到的鏈接可能會有幫助,但我已經解決了這個問題,我很快就會發布我的答案。 – mobileDeveloper