简体   繁体   English

Android Xamarin在Android.Widget中没有WebView

[英]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 我试图在Xamarin中将Vebview添加到我的应用中,并在其中添加了一个带Webview的.axml

axml: 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: 但是,当我打开MainActivity.cs并尝试添加行时:

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

I get 2 errors: 我收到2个错误:

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 严重性代码说明项目文件行抑制状态错误CS0246找不到类型或名称空间名称'WebView'(您是否缺少using指令或程序集引用?)[MainActivity.cs的路径] 54有效

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 严重性代码说明项目文件行抑制统计错误CS0246找不到类型或名称空间名称'WebView'(您是否缺少using指令或程序集引用?)[MainActivity.cs的路径]有效

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

using Android.Webkit;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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