我在地图中以相同颜色显示了多个图钉,但我需要为每个位置显示不同颜色的图钉,这是代码,
Drawable drawable;
AddItemizesOverlay itemizedOvrealy;
drawable = this.getResources().getDrawable(R.drawable.color1);
itemizedOverlay = new AddItemizedOverlay(drawable, mapView);
for(int i=0;i<paramLat.size();i++)
{
lat = Double.parseDouble(paramLat.get(i));
lon = Double.parseDouble(paramLong.get(i));
geoPoint = new GeoPoint((int)(lat * 1E6), (int)(lon *1E6));
geopoints.add(geoPoint);
List<Overlay> mapOverlays = mapView.getOverlays();
name = calloutName.get(i);
overlayitem[i] = new Overlay
Item(geoPoint, calloutName.get(i), "Time: " + calloutTime.get(i));
itemizedOverlay.addOverlay(overlayitem[i]);
mc.animateTo(geoPoint);
}
mapView.getOverlays().add(itemizedOverlay);
AddItemizedOverlay.java
public AddItemizedOverlay(Drawable drawable, MapView mapView) {
super(boundCenter(drawable), mapView);
c = mapView.getContext();
}
这里将引脚图像作为可绘制名称传递为“color1”,但我需要将不同颜色的引脚作为可绘制发送。结果是每个位置都由不同的引脚标记。