共用方式為


LayoutInflater.OnCreateView Method

Definition

Overloads

OnCreateView(String, IAttributeSet)

This routine is responsible for creating the correct subclass of View given the xml element name.

OnCreateView(View, String, IAttributeSet)

Version of #onCreateView(String, AttributeSet) that also takes the future parent of the view being constructed.

OnCreateView(Context, View, String, IAttributeSet)

Version of #onCreateView(View, String, AttributeSet) that also takes the inflation context.

OnCreateView(String, IAttributeSet)

This routine is responsible for creating the correct subclass of View given the xml element name.

[Android.Runtime.Register("onCreateView", "(Ljava/lang/String;Landroid/util/AttributeSet;)Landroid/view/View;", "GetOnCreateView_Ljava_lang_String_Landroid_util_AttributeSet_Handler")]
protected virtual Android.Views.View? OnCreateView (string? name, Android.Util.IAttributeSet? attrs);
[<Android.Runtime.Register("onCreateView", "(Ljava/lang/String;Landroid/util/AttributeSet;)Landroid/view/View;", "GetOnCreateView_Ljava_lang_String_Landroid_util_AttributeSet_Handler")>]
abstract member OnCreateView : string * Android.Util.IAttributeSet -> Android.Views.View
override this.OnCreateView : string * Android.Util.IAttributeSet -> Android.Views.View

Parameters

name
String

The fully qualified class name of the View to be create.

attrs
IAttributeSet

An AttributeSet of attributes to apply to the View.

Returns

View The View created.

Attributes

Exceptions

Remarks

This routine is responsible for creating the correct subclass of View given the xml element name. Override it to handle custom view objects. If you override this in your subclass be sure to call through to super.onCreateView(name) for names you do not recognize.

Java documentation for android.view.LayoutInflater.onCreateView(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

OnCreateView(View, String, IAttributeSet)

Version of #onCreateView(String, AttributeSet) that also takes the future parent of the view being constructed.

[Android.Runtime.Register("onCreateView", "(Landroid/view/View;Ljava/lang/String;Landroid/util/AttributeSet;)Landroid/view/View;", "GetOnCreateView_Landroid_view_View_Ljava_lang_String_Landroid_util_AttributeSet_Handler")]
protected virtual Android.Views.View? OnCreateView (Android.Views.View? parent, string? name, Android.Util.IAttributeSet? attrs);
[<Android.Runtime.Register("onCreateView", "(Landroid/view/View;Ljava/lang/String;Landroid/util/AttributeSet;)Landroid/view/View;", "GetOnCreateView_Landroid_view_View_Ljava_lang_String_Landroid_util_AttributeSet_Handler")>]
abstract member OnCreateView : Android.Views.View * string * Android.Util.IAttributeSet -> Android.Views.View
override this.OnCreateView : Android.Views.View * string * Android.Util.IAttributeSet -> Android.Views.View

Parameters

parent
View

The future parent of the returned view. <em>Note that this may be null.</em>

name
String

The fully qualified class name of the View to be create.

attrs
IAttributeSet

An AttributeSet of attributes to apply to the View.

Returns

View The View created.

Attributes

Exceptions

Remarks

Version of #onCreateView(String, AttributeSet) that also takes the future parent of the view being constructed. The default implementation simply calls #onCreateView(String, AttributeSet).

Java documentation for android.view.LayoutInflater.onCreateView(android.view.View, 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

OnCreateView(Context, View, String, IAttributeSet)

Version of #onCreateView(View, String, AttributeSet) that also takes the inflation context.

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

Parameters

viewContext
Context

The Context to be used as a constructor parameter for the View

parent
View

The future parent of the returned view. <em>Note that this may be null.</em>

name
String

The fully qualified class name of the View to be create.

attrs
IAttributeSet

An AttributeSet of attributes to apply to the View.

Returns

View The View created.

Attributes

Remarks

Version of #onCreateView(View, String, AttributeSet) that also takes the inflation context. The default implementation simply calls #onCreateView(View, String, AttributeSet).

Java documentation for android.view.LayoutInflater.onCreateView(android.content.Context, android.view.View, 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