请教,googlemapview中如何隐藏一个继承自ItemizedOverlay<OverlayItem>的自定义overlay?
这个是自定义且继承自ItemizedOverlay的类
public class EventIconOverlay extends ItemizedOverlay<OverlayItem>{ private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>(); private Context mcontext; public EventIconOverlay(Drawable defaultMarker,Context context) { // super(defaultMarker); super(boundCenterBottom(defaultMarker)); mcontext = context; // TODO Auto-generated constructor stub } @Override public void draw(Canvas canvas, MapView mapView, boolean shadow) { // TODO Auto-generated method stub super.draw(canvas, mapView, shadow); // boundCenterBottom(marker); } @Override public int size() { // TODO Auto-generated method stub return mOverlays.size(); } @Override protected OverlayItem createItem(int i) { // TODO Auto-generated method stub return mOverlays.get(i); } public void addOverlay(OverlayItem overlay) { mOverlays.add(overlay); populate(); } @Override protected boolean onTap(int index) { return true; }}
int length = mapOverlays.size(); Log.e("m_overlays in HideEvent", length+""); for (int i = 0; i < length-1; i++) { if (mapOverlays.get(i) instanceof EventIconOverlay ) { mapOverlays.remove(i); } }// Log.e("m_overlays in HideEvent", length+""); mapView.invalidate();