Partager via


LayoutInflater.CreateView Method

Definition

Overloads

CreateView(String, String, IAttributeSet)

Low-level function for instantiating a view by name.

CreateView(Context, String, String, IAttributeSet)

Low-level function for instantiating a view by name.

CreateView(String, String, IAttributeSet)

Low-level function for instantiating a view by name.

[Android.Runtime.Register("createView", "(Ljava/lang/String;Ljava/lang/String;Landroid/util/AttributeSet;)Landroid/view/View;", "")]
public Android.Views.View? CreateView (string? name, string? prefix, Android.Util.IAttributeSet? attrs);
[<Android.Runtime.Register("createView", "(Ljava/lang/String;Ljava/lang/String;Landroid/util/AttributeSet;)Landroid/view/View;", "")>]
member this.CreateView : string * string * Android.Util.IAttributeSet -> Android.Views.View

Parameters

name
String

The full name of the class to be instantiated.

prefix
String
attrs
IAttributeSet

The XML attributes supplied for this instance.

Returns

View The newly instantiated view, or null.

Attributes

Exceptions

Remarks

Low-level function for instantiating a view by name. This attempts to instantiate a view class of the given <var>name</var> found in this LayoutInflater's ClassLoader. To use an explicit Context in the View constructor, use #createView(Context, String, String, AttributeSet) instead.

There are two things that can happen in an error case: either the exception describing the error will be thrown, or a null will be returned. You must deal with both possibilities -- the former will happen the first time createView() is called for a class of a particular name, the latter every time there-after for that class name.

Java documentation for android.view.LayoutInflater.createView(java.lang.String, java.lang.String, android.util.AttributeSet).

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

CreateView(Context, String, String, IAttributeSet)

Low-level function for instantiating a view by name.

[Android.Runtime.Register("createView", "(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Landroid/util/AttributeSet;)Landroid/view/View;", "", ApiSince=29)]
public Android.Views.View? CreateView (Android.Content.Context viewContext, string name, string? prefix, Android.Util.IAttributeSet? attrs);
[<Android.Runtime.Register("createView", "(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Landroid/util/AttributeSet;)Landroid/view/View;", "", ApiSince=29)>]
member this.CreateView : Android.Content.Context * string * string * Android.Util.IAttributeSet -> Android.Views.View

Parameters

viewContext
Context

The context used as the context parameter of the View constructor

name
String

The full name of the class to be instantiated.

prefix
String
attrs
IAttributeSet

The XML attributes supplied for this instance.

Returns

View The newly instantiated view, or null.

Attributes

Remarks

Low-level function for instantiating a view by name. This attempts to instantiate a view class of the given <var>name</var> found in this LayoutInflater's ClassLoader.

There are two things that can happen in an error case: either the exception describing the error will be thrown, or a null will be returned. You must deal with both possibilities -- the former will happen the first time createView() is called for a class of a particular name, the latter every time there-after for that class name.

Java documentation for android.view.LayoutInflater.createView(android.content.Context, java.lang.String, java.lang.String, android.util.AttributeSet).

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