我创建了一个HTML文件并将其添加到资产文件夹。我添加了一个web视图到axml文件,像这样Android WebView未加载HTML文件
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/LocalWebView">
</WebView>
,并试图用下面的代码
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.Teams);
WebView localWebView = FindViewById<WebView>(Resource.Id.LocalWebView);
localWebView.LoadUrl("file:///android_asset/Content/Teams.html");
}
它告诉我该文件未找到加载它。是否有其他地方的资产文件夹,我不得不添加HTML页面或其他我必须做的?
你确定你的文件是你认为它在你的项目的'assets /'中吗? – CommonsWare
是的,其中唯一的其他文件是“aboutassets”。这应该是对的吗? –
'除了assets文件夹我还要添加html页面吗?您应该将其添加到资产中的“内容”文件夹。 – greenapps