【发布时间】:2015-11-25 05:43:09
【问题描述】:
我在我的应用程序中使用标记集群。我想增加网格大小。我已经自定义了 DefaultClusterRenderer 类,但是我没有找到任何可以增加大小的东西。请帮我看看如何增加它。 下面是自定义clusterRenderer的代码
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");
}
}
}
【问题讨论】:
-
@Verma 谢谢,提到的链接可能会有所帮助,但我已经解决了这个问题,我会尽快发布我的答案。
标签: google-maps google-maps-markers google-maps-android-api-2