我創建了一個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