WebView 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| 名称 | 说明 |
|---|---|
| WebView(Context) |
使用活动上下文对象构造新的 WebView。 |
| WebView(Context, IAttributeSet) |
使用布局参数构造新的 WebView。 |
| WebView(IntPtr, JniHandleOwnership) |
创建 JNI 对象的托管表示形式时使用的构造函数;由运行时调用。 |
| WebView(Context, IAttributeSet, Int32) |
使用布局参数和默认样式构造新的 WebView。 |
| WebView(Context, IAttributeSet, Int32, Boolean) |
已过时.
使用布局参数和默认样式构造新的 WebView。 |
| WebView(Context, IAttributeSet, Int32, Int32) |
使用布局参数和默认样式构造新的 WebView。 |
WebView(Context)
使用活动上下文对象构造新的 WebView。
[Android.Runtime.Register(".ctor", "(Landroid/content/Context;)V", "")]
public WebView(Android.Content.Context context);
[<Android.Runtime.Register(".ctor", "(Landroid/content/Context;)V", "")>]
new Android.Webkit.WebView : Android.Content.Context -> Android.Webkit.WebView
参数
- context
- Context
用于访问应用程序资产的活动上下文
- 属性
注解
使用活动上下文对象构造新的 WebView。
<b>注意:</b> WebView 应始终使用活动上下文实例化。 如果使用应用程序上下文实例化,WebView 将无法提供多个功能,例如 JavaScript 对话框和自动填充。
Java文档android.webkit.WebView.WebView(android.content.Context)。
本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。
适用于
WebView(Context, IAttributeSet)
使用布局参数构造新的 WebView。
[Android.Runtime.Register(".ctor", "(Landroid/content/Context;Landroid/util/AttributeSet;)V", "")]
public WebView(Android.Content.Context context, Android.Util.IAttributeSet? attrs);
[<Android.Runtime.Register(".ctor", "(Landroid/content/Context;Landroid/util/AttributeSet;)V", "")>]
new Android.Webkit.WebView : Android.Content.Context * Android.Util.IAttributeSet -> Android.Webkit.WebView
参数
- context
- Context
用于访问应用程序资产的活动上下文
- attrs
- IAttributeSet
传递给父级的 AttributeSet
- 属性
注解
使用布局参数构造新的 WebView。
Java文档android.webkit.WebView.WebView(android.content.Context, android.util.AttributeSet)。
本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。
适用于
WebView(IntPtr, JniHandleOwnership)
创建 JNI 对象的托管表示形式时使用的构造函数;由运行时调用。
protected WebView(IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);
new Android.Webkit.WebView : nativeint * Android.Runtime.JniHandleOwnership -> Android.Webkit.WebView
参数
- transfer
- JniHandleOwnership
指示 JniHandleOwnership如何处理 javaReference
注解
本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。
适用于
WebView(Context, IAttributeSet, Int32)
使用布局参数和默认样式构造新的 WebView。
[Android.Runtime.Register(".ctor", "(Landroid/content/Context;Landroid/util/AttributeSet;I)V", "")]
public WebView(Android.Content.Context context, Android.Util.IAttributeSet? attrs, int defStyleAttr);
[<Android.Runtime.Register(".ctor", "(Landroid/content/Context;Landroid/util/AttributeSet;I)V", "")>]
new Android.Webkit.WebView : Android.Content.Context * Android.Util.IAttributeSet * int -> Android.Webkit.WebView
参数
- context
- Context
用于访问应用程序资产的活动上下文
- attrs
- IAttributeSet
传递给父级的 AttributeSet
- defStyleAttr
- Int32
当前主题中的一个属性,其中包含对提供视图默认值的样式资源的引用。 可以是 0,无法查找默认值。
- 属性
注解
使用布局参数和默认样式构造新的 WebView。
Java文档android.webkit.WebView.WebView(android.content.Context, android.util.AttributeSet, int)。
本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。
适用于
WebView(Context, IAttributeSet, Int32, Boolean)
注意
deprecated
使用布局参数和默认样式构造新的 WebView。
[Android.Runtime.Register(".ctor", "(Landroid/content/Context;Landroid/util/AttributeSet;IZ)V", "")]
[System.Obsolete("deprecated")]
public WebView(Android.Content.Context context, Android.Util.IAttributeSet? attrs, int defStyleAttr, bool privateBrowsing);
[<Android.Runtime.Register(".ctor", "(Landroid/content/Context;Landroid/util/AttributeSet;IZ)V", "")>]
[<System.Obsolete("deprecated")>]
new Android.Webkit.WebView : Android.Content.Context * Android.Util.IAttributeSet * int * bool -> Android.Webkit.WebView
参数
- context
- Context
用于访问应用程序资产的活动上下文
- attrs
- IAttributeSet
传递给父级的 AttributeSet
- defStyleAttr
- Int32
当前主题中的一个属性,其中包含对提供视图默认值的样式资源的引用。 可以是 0,无法查找默认值。
- privateBrowsing
- Boolean
此 WebView 是否将在专用模式下初始化
- 属性
注解
使用布局参数和默认样式构造新的 WebView。
此成员已弃用。 不再直接通过 WebView 支持专用浏览,将在将来的版本中删除。 首选使用WebSettings和 WebViewDatabaseCookieManagerWebStorage精细控制隐私数据。
本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。
适用于
WebView(Context, IAttributeSet, Int32, Int32)
使用布局参数和默认样式构造新的 WebView。
[Android.Runtime.Register(".ctor", "(Landroid/content/Context;Landroid/util/AttributeSet;II)V", "")]
public WebView(Android.Content.Context context, Android.Util.IAttributeSet? attrs, int defStyleAttr, int defStyleRes);
[<Android.Runtime.Register(".ctor", "(Landroid/content/Context;Landroid/util/AttributeSet;II)V", "")>]
new Android.Webkit.WebView : Android.Content.Context * Android.Util.IAttributeSet * int * int -> Android.Webkit.WebView
参数
- context
- Context
用于访问应用程序资产的活动上下文
- attrs
- IAttributeSet
传递给父级的 AttributeSet
- defStyleAttr
- Int32
当前主题中的一个属性,其中包含对提供视图默认值的样式资源的引用。 可以是 0,无法查找默认值。
- defStyleRes
- Int32
样式资源的资源标识符,它提供视图的默认值,仅当 defStyleAttr 为 0 或无法在主题中找到时才使用。 可以是 0,无法查找默认值。
- 属性
注解
使用布局参数和默认样式构造新的 WebView。
Java文档android.webkit.WebView.WebView(android.content.Context, android.util.AttributeSet, int, int)。
本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。