谷歌地图仍然呈现标记其取出后
问题描述:
香港专业教育学院一直在写一些应用程序,并卡住了从地图中删除一个项目,这是从我的代码一个初步认识片段:谷歌地图仍然呈现标记其取出后
protected boolean onTap(final int index) {
tapped=true;
AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
dialog.setTitle("Remove Item");
dialog.setMessage("Are you sure you want to Remove this Item?");
dialog.setNegativeButton("No", null);
dialog.setPositiveButton("Yes", new OnClickListener() {
@SuppressWarnings("unchecked")
@Override
public void onClick(DialogInterface arg0, int arg1) {
mOverlays.remove(index);
ItemOverlay.this.populate();
ItemOverlay.this.setLastFocusedIndex(-1);
ItemOverlay.this.setFocus(null);
}
});
dialog.show();
return true;
}
,你可以看到我删除被点击的项目,并确保没有任何焦点,但删除的项目仍然被绘制,直到用户点击屏幕的另一个点或滚动地图。
我还应该尝试什么?
答
你要记得更新的MapView:
mapview.invalidate();
我想出了一个可爱的前一阵子,感谢寿! – 2012-08-17 08:36:11
呵呵没问题:) – Warpzit 2012-08-17 08:36:45