如何更改群集中标记的颜色? [英] How to change the color of markers in cluster?

查看:113
本文介绍了如何更改群集中标记的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索并发现只改变集群图标的颜色是可能的,标记只采用默认颜色
,请帮助......感谢提前

I searched and found out that it is possible to change color of only the cluster icon, the markers take only the default color please help...thanks is advance

public class MyItem implements ClusterItem {
private final LatLng mPosition;
private final String mTitle;
private final String mSnippet;

public MyItem(double lat, double lng) {
    mPosition = new LatLng(lat, lng);
}

public MyItem(double lat, double lng, String title, String snippet) {
    mPosition = new LatLng(lat, lng);
    mTitle = title;
    mSnippet = snippet;
}

@Override
public LatLng getPosition() {
    return mPosition;
}

@Override
public String getTitle() {
    return mTitle;
}

@Override
public String getSnippet() {
    return mSnippet;
} }


推荐答案

CustomClusterRenderer。

We can Override getColor in CustomClusterRenderer.

public class CustomClusterRenderer extends DefaultClusterRenderer<CustomClusterItem> {

@Override
    protected int getColor(int clusterSize) {
        return Color.parseColor("#567238");
    }
}

这篇关于如何更改群集中标记的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆