在我的Android地图应用程序中,我试图替换触摸事件上的标记。这是我的叠加项目类和我在主类中定义的默认标记。
public class MyItemizedOverlay extends ItemizedOverlay<OverlayItem> {
Bitmap marker = BitmapFactory.decodeResource( null, R.drawable.image_pin);//Replace with this marker
private ArrayList<OverlayItem> myOverlaysNormal ;
Context mContext;
public MyItemizedOverlay(Drawable defaultMarker) {
super(boundCenterBottom(defaultMarker));
myOverlaysNormal = new ArrayList<OverlayItem>();
populate();
}
public void addOverlay(OverlayItem overlay){
myOverlaysNormal.add(overlay);
populate();
}
@Override
protected OverlayItem createItem(int i) {
return myOverlaysNormal.get(i);
}
@Override
protected boolean onTap(int index) {
myOverlaysNormal.get(index).getPoint();
return true;
}
// Removes overlay item i
public void removeItem(int i){
myOverlaysNormal.remove(i);
populate();
}
// Returns present number of items in list
@Override
public int size() {
return myOverlaysNormal.size();
}
public void addOverlayItem(OverlayItem overlayItem) {
myOverlaysNormal.add(overlayItem);
populate();
}
}
如何用其他标记替换触摸的标记(R.Drawable.image_pin).. OR 如何展开标记默认标记?