I'm trying to show a map in xamarin using a WebView component, try passing this code to an html file and it works fine. The WebView is from Xamarin.Forms
The line alert('test');
and the word App in the body of the html is shown without problems, but the map doesn't show.
The devise for test was running android 9
var browser = new WebView();
browser.HeightRequest = 600;
browser.WidthRequest = 600;
var htmlSource = new HtmlWebViewSource();
htmlSource.Html = @"<html>
<head>
<script src='http://www.openlayers.org/api/OpenLayers.js'></script>
</head>
<body>
App
<div id='mapdiv'></div>
<script>
alert('test');
map = new OpenLayers.Map('mapdiv');
map.addLayer(new OpenLayers.Layer.OSM());
var lonLat = new OpenLayers.LonLat(-0.1279688, 51.5077286)
.transform(
new OpenLayers.Projection('EPSG:4326'),
map.getProjectionObject()
);
var zoom = 16;
var markers = new
OpenLayers.Layer.Markers('Markers');
map.addLayer(markers);
markers.addMarker(new OpenLayers.Marker(lonLat));
map.setCenter(lonLat, zoom);
</script>
</body></html>";
browser.Source = htmlSource;
Children.Add(browser);