В настоящее время я пытаюсь изменить цвет значка кластера (по умолчанию синий), но я не могу понять его. Я уже создал свой менеджер кластера и т. Д., И я сам вижу значок, но он синий. В настоящее время я использую настройку Google по умолчанию (см. Код ниже) для настройки моей карты. Любая помощь будет оцененаКак изменить цвет кластеров на моей карте Google Android?
Спасибо,
Jacob
public class MainActivity extends Activity {
GoogleMap map;
ClusterManager mClusterManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MapFragment mapFragment = (MapFragment) getFragmentManager()
.findFragmentById(R.id.map);
map = mapFragment.getMap();
setUpClusterer();
}
private void setUpClusterer() {
// Declare a variable for the cluster manager.
// Position the map.
map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(51.503186, -0.126446), 10));
// Initialize the manager with the context and the map.
// (Activity extends context, so we can pass 'this' in the constructor.)
mClusterManager = new ClusterManager<MyItem>(this, map);
// Point the map's listeners at the listeners implemented by the cluster
// manager.
map.setOnCameraChangeListener(mClusterManager);
map.setOnMarkerClickListener(mClusterManager);
// Add cluster items (markers) to the cluster manager.
addItems();
}
private void addItems() {
// Set some lat/lng coordinates to start with.
double lat = 51.5145160;
double lng = -0.1270060;
// Add ten cluster items in close proximity, for purposes of this example.
for (int i = 0; i < 2; i++) {
double offset = i/60d;
lat = lat + offset;
lng = lng + offset;
MyItem offsetItem = new MyItem(lat, lng);
mClusterManager.addItem(offsetItem);
}
}
}
class MyItem implements ClusterItem {
private final LatLng mPosition;
public MyItem(double lat, double lng) {
mPosition = new LatLng(lat, lng);
}
@Override
public LatLng getPosition() {
return mPosition;
}
}
Вы можете попробовать, чтобы иметь собственную иконку для кластера https: //developers.google.com/maps/documentation/android/utility/marker-clustering#custom – Verma