Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/192.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如果在“中”设置,CSS不工作%&引用;_Android_Css_Html_Google Maps Api 3 - Fatal编程技术网

Android 如果在“中”设置,CSS不工作%&引用;

Android 如果在“中”设置,CSS不工作%&引用;,android,css,html,google-maps-api-3,Android,Css,Html,Google Maps Api 3,我希望将标签的高度和宽度设置为100%,现在在其他示例中,它使用下面演示的标签工作。但在下面给出的代码中,如果我删除“style=”width:370px;高度:505px“,并在meta标记后添加以下代码 <style type="text/css> body{ height:100%; width:100%; } #map-canvas{ height:100%; width:100%; } </style> 我用你的代码做了一个jsfiddle

我希望将标签的高度和宽度设置为100%,现在在其他示例中,它使用下面演示的标签工作。但在下面给出的代码中,如果我删除“style=”width:370px;高度:505px“,并在meta标记后添加以下代码

<style type="text/css>
body{
  height:100%;
  width:100%;
}
#map-canvas{
  height:100%;
  width:100%;
}
</style>

我用你的代码做了一个jsfiddle


…Rohit Azad的答案是,在文档样式中添加
html
标记,这似乎解决了您的问题(至少在JSFIDLE上是这样)。

在第二行中,我忘了提到“from标记”。还有,忘记在CSS后面加引号了。抱歉。习惯于html,body{height:100%;}它只显示按钮,地图不显示。哦,工作了!!!,谢谢Rohit Azad!
<head>  
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true">     </script>
    <script type="text/javascript">

      var shape;
      function initialize() {
        var mapDiv = document.getElementById('map-canvas');
        var map = new google.maps.Map(mapDiv, {
          center: new google.maps.LatLng(24.886436490787712, -70.2685546875),
          zoom: 4,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        });

        shape = new google.maps.Polygon({
          strokeColor: '#ff0000',
          strokeOpacity: 0.8,
          strokeWeight: 2,
          fillColor: '#ff0000',
          fillOpacity: 0.35
        });

        shape.setMap(map);

        google.maps.event.addListener(map, 'click', addPoint);

      }

      function addPoint(e) {

        var vertices = shape.getPath();
        vertices.push(e.latLng);

      }
      function clearmap(){      
        initialize();  
      }


      google.maps.event.addDomListener(window, 'load', initialize);
    </script>
  </head>
  <body style="font-family: Arial; border: 0 none;">
    <div id="map-canvas" style="width: 370px; height: 505px"></div>
    <input type="button" value="click" onclick="clearmap"()>
  </body>