El ejemplo debería verse de la siguiente manera:
El código lo dejo a continuación:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> | |
<style type="text/css"> | |
html { | |
height: 100% | |
} | |
body { | |
height: 100%; | |
margin: 0; | |
padding: 0 | |
} | |
#map_canvas { | |
height: 100% | |
} | |
</style> | |
<script type="text/javascript" | |
src="http://maps.googleapis.com/maps/api/js?key=AQUI_VA_EL_API_KEY&sensor=true"> | |
</script> | |
<script type="text/javascript"> | |
function initialize() { | |
var posicion_mapa = new google.maps.LatLng(-4.3871819, -76.0684254); | |
var ubicaciones = [['Punto 1',-4.3871819, -76.0684254], | |
['Punto 2',-2.1872870, -74.4541685], | |
['Punto 3',-3.0762320, -77.3627988]] | |
var mapOptions = { | |
center: posicion_mapa, | |
zoom: 7, | |
mapTypeId: google.maps.MapTypeId.ROADMAP | |
}; | |
var map = new google.maps.Map(document.getElementById("map_canvas"), | |
mapOptions); | |
var infoWindow = new google.maps.InfoWindow(); | |
for(i = 0; i < ubicaciones.length; i++){ | |
marcador = new google.maps.Marker({ | |
position: new google.maps.LatLng(ubicaciones[i][1],ubicaciones[i][2]), | |
map:map, | |
title:"Plop " + i | |
}); | |
google.maps.event.addListener(marcador, 'click', (function(marcador,i) { | |
return function(){ | |
infoWindow.setContent(ubicaciones[i][0]); | |
infoWindow.open(map, marcador); | |
} | |
})(marcador,i)); | |
} | |
} | |
</script> | |
</head> | |
<body onload="initialize()"> | |
<div id="map_canvas" style="width: 100%; height: 100%"></div> | |
</body> | |
</html> |
2 comentarios:
Esto es codigo html para android o para c#
Es código HTML para una webapp, aunque no lo he testeado en mi movil aun, solo en mi navegador.
Entiendo que en el caso de Android, el seteo de variables se realizaría dentro de un Activity.
Publicar un comentario