?
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));?
?
?