简体   繁体   中英

Android Xamarin no WebView in Android.Widget

I tried to add a Vebview to my app in Xamarin, I made a .axml with a webview in it

axml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minWidth="25px"
android:minHeight="25px">
<WebView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/LocalWebView" />

But when I open MainActivity.cs and try to add line:

SetContentView(Resource.Layout.Kaamera);
WebView WV = FindViewById<WebView>(Resource.Id.LocalWebView);

I get 2 errors:

Severity Code Description Project File Line Suppression State Error CS0246 The type or namespace name 'WebView' could not be found (are you missing a using directive or an assembly reference?) [Path to MainActivity.cs] 54 Active

Severity Code Description Project File Line Suppression Stat Error CS0246 The type or namespace name 'WebView' could not be found (are you missing a using directive or an assembly reference?) [Path to MainActivity.cs] Active

如果要使用Webview,则需要在yout代码的开头添加以下几行。

using Android.Webkit;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM