2011-07-15 141 views

回答

1

你需要通過擴展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. */ 
    } 
}