【发布时间】:2026-02-12 10:20:02
【问题描述】:
我在加载页面 File.html 时遇到问题。我想在 html 中加载我的地图,但模拟器没有显示。我得到了错误:
" [INFO:CONSOLE(0)] "不允许加载本地资源:file:///android_asset/HTMLPage1.html",来源:data:text/html,chromewebdata(0)"
" I/chromium(11080): [INFO:CONSOLE(0)] "不允许加载本地资源:file:///android_asset/webkit/android-weberror.png",来源: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";
}
【问题讨论】:
-
我试过了,还是不行
-
如果您在 Forms 的 WebView 中使用
file:///android_asset加载内容,那么您没有遵循我链接的指南,file:///android_asset用于 AndroidWebView小部件,而不是 Form 的 @ 987654327@
标签: javascript android html google-maps xamarin