多个标记(具有不同的可绘制)(谷歌地图)

时间:2011-11-10 05:43:13

标签: android google-maps

如何在谷歌地图中实现多个标记,同时每个标记具有独特的可绘制。 onTap仅委派给最后一批标记。但是对于第一批绘制的标记,onTap将不起作用。

for(int i = 0; i < allLongitude.length; i++){
        if(dir_id[i] == 1){

            point = new GeoPoint((int)(allLongitude[i] * 1E6), (int)(allLatitude[i] * 1E6));
            OverlayItem overlayitem1 = new OverlayItem(point, ""+  dir_id[i]  + "\\" + super_id[i] + " " + name[i], "" + "Do you want to view its profile?");
            itemizedOverlay1.addOverlay(overlayitem1);
        }
        else if(dir_id[i] == 2){

            point = new GeoPoint((int)(allLongitude[i] * 1E6), (int)(allLatitude[i] * 1E6));
            OverlayItem overlayitem1 = new OverlayItem(point, ""+  dir_id[i]  + "\\" + super_id[i] + " " + name[i], "" + "Do you want to view its profile?");
            itemizedOverlay2.addOverlay(overlayitem1);
        }

        Toast.makeText(this, "" + i, Toast.LENGTH_SHORT).show();

    }
        mapOverlays.add(itemizedOverlay2);
    mapOverlays.add(itemizedOverlay1);

0 个答案:

没有答案