samedi 15 novembre 2014

How to control webview in android to display proper google visualization maps?


Vote count:

0




I am trying to



My web view settings are as follows -

webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setUseWideViewPort(true);
webView.requestFocusFromTouch();
webView.requestFocus(View.FOCUS_DOWN);
webView.getSettings().setLoadWithOverviewMode(true);
webView.setInitialScale(getScale());
//webView.setWebViewClient(new WebViewClient());
webView.setWebChromeClient(new WebChromeClient());


// String containing js to draw map using google's Visualization:Geochart



String js = "<html><head>" +
"<script type='"+"text/javascript"+"' src='"+"http://ift.tt/JuZcy0"+"'></script>"+
"<script type='"+"text/javascript"+"'>" +
"google.load('"+"visualization"+"', '"+"1"+"', {packages:['"+"geomap"+"']});" +
"google.setOnLoadCallback(drawRegionsMap);" +
" function drawRegionsMap() {" +
" var data = google.visualization.arrayToDataTable([" +
"['Country', '"+name+"']," + build +
"]);" +
"var options = {colors: ['"+startColor+"', '"+endColor+"']};" +
"var chart = new google.visualization.GeoChart(document.getElementById('regions_div'));" +
"chart.draw(data, options);" +
"}" +
"</script>" +
"</head>" +
"<body bgcolor='#E6E6FA'>" +
"<div id='"+"regions_div"+"' style='"+"width:100%; height: 100%;"+"'></div>" +
"</body>" +
"</html>";


The code is working fine . I get different regions of map with different colors. But I need that only web view get translated in landscape mode by keeping default screen orientation of fragment (activity) as POTRAIT . Also when I click on region a popup displays the proper name of country, but popup also opens outside the region on click on any where in the map. Even I tried on chrome browser in mobile it has same problem. Where as the same visualization is working fine on normal web browser on computer.



asked 35 secs ago







How to control webview in android to display proper google visualization maps?

Aucun commentaire:

Enregistrer un commentaire