首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

GoogleMap Web版在android中的运用

2012-06-27 
GoogleMap Web版在android中的应用?Html部份:google.html?!DOCTYPE htmlhtmlheadmeta nameviewpo

GoogleMap Web版在android中的应用

?

Html部份:

google.html

?

<!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: 0px; padding: 0px }  #map_canvas { height: 100% }</style><script type="text/javascript" src="https://maps-api-ssl.google.com/maps/api/js?v=3&sensor=false"></script><script type="text/javascript">  function initialize(latitude,longitude) {    alert(latitude+","+longitude);    var latlng = new google.maps.LatLng(latitude,longitude);    var myOptions = {      zoom: 15,      center: latlng,      disableDefaultUI: true,      mapTypeId: google.maps.MapTypeId.ROADMAP    };    var map = new google.maps.Map(document.getElementById("map_canvas"),        myOptions);   var image = 'iconmarka.png';   var beachMarker = new google.maps.Marker({      position: latlng,       map: map,      icon: image  });   }</script></head><body>  <div id="map_canvas" style="width:100%; height:100%"></div></body></html>

?

?Java部份:

?

 //以下两句为需要显示的经纬度 double latitude = tmppicinfo.getLatitude();  double longitude = tmppicinfo.getLongitude();  /** 地图RL容器 **/  WebView webmap = (WebView) findViewById(R.id.webmap);  webmap.getSettings().setJavaScriptEnabled(true);  webmap.loadUrl(weburl);//将google.html放到assets目录下,weburl为google.html的URI  webmap.setWebViewClient(new MyWebViewClient(latitude, longitude));
?

?

?

热点排行