2014-09-01 371 views
0

我正在使用谷歌地图API在我的手机应用程序中显示地图。谷歌地图无法正常显示在手机上

当地图加载我得到的问题象下面这样:

地图不正确DIV加载。只显示地图的一部分。

enter image description here

我用下面的代码来显示地图:

HTML是:

<div id="mapOuterDiv_details" class="mapHolder"> 
    <div id="map_details"> 
     </div> 
</div> 

我加载地图中ID为 “map_details”。

我给出了div的100%宽度和100%高度。

和JavaScript代码是:

var mapOptions = { 
     center: new google.maps.LatLng(19.997779,73.789684), 
     zoom: 11, 
     mapTypeId: google.maps.MapTypeId.ROADMAP 
     }; 


     var map = new google.maps.Map(document.getElementById("map_details"), mapOptions); 

     var marker = new google.maps.Marker({ 
              position: new google.maps.LatLng(19.997779,73.789684), 
              map: map, 
              animation: google.maps.Animation.DROP 
              }); 


     google.maps.event.trigger(map, 'resize'); 

由于提前, Tejas的

+1

这个工作对我.... //调用调整函数加载格设置后正确加载地图 google.maps.event.addListenerOnce(地图, '空闲',函数(){ google.maps。 event.trigger(地图, '调整'); \t \t \t \t \t \t \t \t \t \t}); – 2014-09-01 07:18:22

回答

0

你想用我的插件PhoneGap的,谷歌地图,插件? https://github.com/wf9a5m75/phonegap-googlemaps-plugin

您可以在Android和iOS上运行Google Maps SDK,并通过JavaScript轻松控制它。 image

+0

感谢wf9a5m75你的努力。下面的解决方案适用于我:google.maps.event.addListenerOnce(map,'idle',function(){google.maps.event.trigger(map,'resize');}); – 2014-09-09 06:16:23