我们在xamarin中以webview格式实现了openlayers。当我通过向xamarin添加捕获功能进行捕获时,openlayers的地图部分为白色,并且当我使用openlayer的export-png函数时,对xamarin没有响应。我需要这个问题的帮助
var activity = Xamarin.Forms.Forms.Context as MainActivity;
if (activity == null) {
return null;
}
var view = activity.Window.DecorView;
view.DrawingCacheEnabled = true;
Bitmap bitmap = view.GetDrawingCache(true);
byte[] bitmapData;
using (var stream = new MemoryStream()) {
bitmap.Compress(Bitmap.CompressFormat.Png, 0, stream);
bitmapData = stream.ToArray();
}
return bitmapData;