我想创建一个覆盖项,所以如果用户点击覆盖项,则会弹出一个带有列表视图的对话框。我该怎么做呢?
提前谢谢..
发布于 2011-07-15 16:11:27
您需要通过扩展ItemizedOverlay来创建自己的覆盖。当点击一个项目时,您可以重写onTap()方法来做任何您想做的事情。
基本的愚蠢示例:
public class CustomOverlay extends ItemizedOverlay<OverlayItem> {
private Activity mContext;
public CustomOverlay(Activity activity, Drawable defaultIcon) {
super(defaultIcon);
mContext = activity;
}
@Override
protected boolean onTap(int index) {
new AlertDialog.Builder(mContext).setItems(...
/* Etc. - You can show the dialog here. */
}
}https://stackoverflow.com/questions/6704010
复制相似问题