我有一个mapview,我在其中添加了引脚。
以下是CustomPinPoint类:
public class CustomPinpoint extends ItemizedOverlay<OverlayItem>{
private ArrayList<OverlayItem> pinpoints = new ArrayList<OverlayItem>();
private Context c;
public CustomPinpoint(Drawable defaultMarker) {
super(boundCenter(defaultMarker));
// TODO Auto-generated constructor stub
}
public CustomPinpoint(Drawable m, Context context) {
// TODO Auto-generated constructor stub
this(m);
c = context;
}
@Override
protected OverlayItem createItem(int i) {
// TODO Auto-generated method stub
return pinpoints.get(i);
}
@Override
public int size() {
// TODO Auto-generated method stub
return pinpoints.size();
}
public void insertPinpoint(OverlayItem item){
pinpoints.add(item);
this.populate();
}
}
这就是我添加引脚的方式:
Touchy t = new Touchy();
overlayList = map.getOverlays();
overlayList.add(t);
compass = new MyLocationOverlay(Map.this, map);
overlayList.add(compass);
controller = map.getController();
OverlayItem overlayItem = new OverlayItem(ourLocation, "What's up", "2nd String");
CustomPinpoint custom = new CustomPinpoint(d, Map.this);
custom.insertPinpoint(overlayItem);
overlayList.add(custom);
一切都很好,但我不知道当我敲击别针时我怎么能出现气球(或其他类)。我有一个包含每个引脚描述的数据库,因此我需要在引脚上每次点击都显示描述。