WebView Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
WebView(Context) |
Constructs a new WebView with an Activity Context object. |
WebView(Context, IAttributeSet) |
Constructs a new WebView with layout parameters. |
WebView(IntPtr, JniHandleOwnership) |
A constructor used when creating managed representations of JNI objects; called by the runtime. |
WebView(Context, IAttributeSet, Int32) |
Constructs a new WebView with layout parameters and a default style. |
WebView(Context, IAttributeSet, Int32, Boolean) |
Obsolete.
Constructs a new WebView with layout parameters and a default style. |
WebView(Context, IAttributeSet, Int32, Int32) |
Constructs a new WebView with layout parameters and a default style. |
WebView(Context)
Constructs a new WebView with an Activity Context object.
[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
Parameters
- context
- Context
an Activity Context to access application assets
- Attributes
Remarks
Constructs a new WebView with an Activity Context object.
<p class="note"><b>Note:</b> WebView should always be instantiated with an Activity Context. If instantiated with an Application Context, WebView will be unable to provide several features, such as JavaScript dialogs and autofill.
Java documentation for android.webkit.WebView.WebView(android.content.Context)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
WebView(Context, IAttributeSet)
Constructs a new WebView with layout parameters.
[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
Parameters
- context
- Context
an Activity Context to access application assets
- attrs
- IAttributeSet
an AttributeSet passed to our parent
- Attributes
Remarks
Constructs a new WebView with layout parameters.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
WebView(IntPtr, JniHandleOwnership)
A constructor used when creating managed representations of JNI objects; called by the runtime.
protected WebView (IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);
new Android.Webkit.WebView : nativeint * Android.Runtime.JniHandleOwnership -> Android.Webkit.WebView
Parameters
- transfer
- JniHandleOwnership
A JniHandleOwnershipindicating how to handle javaReference
Remarks
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
WebView(Context, IAttributeSet, Int32)
Constructs a new WebView with layout parameters and a default style.
[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
Parameters
- context
- Context
an Activity Context to access application assets
- attrs
- IAttributeSet
an AttributeSet passed to our parent
- defStyleAttr
- Int32
an attribute in the current theme that contains a reference to a style resource that supplies default values for the view. Can be 0 to not look for defaults.
- Attributes
Remarks
Constructs a new WebView with layout parameters and a default style.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
WebView(Context, IAttributeSet, Int32, Boolean)
Caution
deprecated
Constructs a new WebView with layout parameters and a default style.
[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
Parameters
- context
- Context
an Activity Context to access application assets
- attrs
- IAttributeSet
an AttributeSet passed to our parent
- defStyleAttr
- Int32
an attribute in the current theme that contains a reference to a style resource that supplies default values for the view. Can be 0 to not look for defaults.
- privateBrowsing
- Boolean
whether this WebView will be initialized in private mode
- Attributes
Remarks
Constructs a new WebView with layout parameters and a default style.
This member is deprecated. Private browsing is no longer supported directly via WebView and will be removed in a future release. Prefer using WebSettings
, WebViewDatabase
, CookieManager
and WebStorage
for fine-grained control of privacy data.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
WebView(Context, IAttributeSet, Int32, Int32)
Constructs a new WebView with layout parameters and a default style.
[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
Parameters
- context
- Context
an Activity Context to access application assets
- attrs
- IAttributeSet
an AttributeSet passed to our parent
- defStyleAttr
- Int32
an attribute in the current theme that contains a reference to a style resource that supplies default values for the view. Can be 0 to not look for defaults.
- defStyleRes
- Int32
a resource identifier of a style resource that supplies default values for the view, used only if defStyleAttr is 0 or can not be found in the theme. Can be 0 to not look for defaults.
- Attributes
Remarks
Constructs a new WebView with layout parameters and a default style.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.