我无法加载页面File.html。我想在html中加载我的地图,但模拟器没有显示。我得到错误:Xamarin不允许加载本地资源文件
“[INFO:CONSOLE(0)]”不允许加载本地资源:file:///android_asset/HTMLPage1.html“,source:data:text/html,chromewebdata(0)”
“I/chromium(11080):[INFO:CONSOLE(0)]”不允许加载本地资源:file:///android_asset/webkit/android-weberror.png“,source:data:text/HTML,chromewebdata(0)“
在仿真页面显示 ”网页无法使用“
XAML文件:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Mapaht"
x:Class="Mapaht.Mapahet">
<WebView
x:Name="webviewjava"></WebView>
</ContentPage>
页文件
public Mapahet()
{
InitializeComponent();
webviewjava.Source = "file:///android_asset/HTMLPage1.html";
}
https://developer.xamarin.com/guides/xamarin-forms/user-interface/webview/ #Android – SushiHangover
我试过了,它不工作 –
如果你在Forms的WebView中使用'file:/// android_asset'来加载内容,那么你没有按照我所链接的指南,'file:/// android_asset'是用于Android'WebView'小部件,而不是表单的'WebView' – SushiHangover