Udostępnij za pośrednictwem


LayoutInflater.IFactory.OnCreateView(String, Context, IAttributeSet) Method

Definition

Hook you can supply that is called when inflating from a LayoutInflater.

[Android.Runtime.Register("onCreateView", "(Ljava/lang/String;Landroid/content/Context;Landroid/util/AttributeSet;)Landroid/view/View;", "GetOnCreateView_Ljava_lang_String_Landroid_content_Context_Landroid_util_AttributeSet_Handler:Android.Views.LayoutInflater/IFactoryInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Android.Views.View? OnCreateView (string name, Android.Content.Context context, Android.Util.IAttributeSet attrs);
[<Android.Runtime.Register("onCreateView", "(Ljava/lang/String;Landroid/content/Context;Landroid/util/AttributeSet;)Landroid/view/View;", "GetOnCreateView_Ljava_lang_String_Landroid_content_Context_Landroid_util_AttributeSet_Handler:Android.Views.LayoutInflater/IFactoryInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member OnCreateView : string * Android.Content.Context * Android.Util.IAttributeSet -> Android.Views.View

Parameters

name
String

Tag name to be inflated.

context
Context

The context the view is being created in.

attrs
IAttributeSet

Inflation attributes as specified in XML file.

Returns

View Newly created view. Return null for the default behavior.

Attributes

Remarks

Hook you can supply that is called when inflating from a LayoutInflater. You can use this to customize the tag names available in your XML layout files.

Note that it is good practice to prefix these custom names with your package (i.e., com.coolcompany.apps) to avoid conflicts with system names.

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