Share via


LayoutInflater.Inflate Method

Definition

Overloads

Inflate(Int32, ViewGroup)

Inflate a new view hierarchy from the specified xml resource.

Inflate(XmlReader, ViewGroup)

Inflate a new view hierarchy from the specified xml node.

Inflate(Int32, ViewGroup, Boolean)

Inflate a new view hierarchy from the specified xml resource.

Inflate(XmlReader, ViewGroup, Boolean)

Inflate a new view hierarchy from the specified XML node.

Inflate(Int32, ViewGroup)

Inflate a new view hierarchy from the specified xml resource.

[Android.Runtime.Register("inflate", "(ILandroid/view/ViewGroup;)Landroid/view/View;", "GetInflate_ILandroid_view_ViewGroup_Handler")]
public virtual Android.Views.View? Inflate (int resource, Android.Views.ViewGroup? root);
[<Android.Runtime.Register("inflate", "(ILandroid/view/ViewGroup;)Landroid/view/View;", "GetInflate_ILandroid_view_ViewGroup_Handler")>]
abstract member Inflate : int * Android.Views.ViewGroup -> Android.Views.View
override this.Inflate : int * Android.Views.ViewGroup -> Android.Views.View

Parameters

resource
Int32

ID for an XML layout resource to load (e.g., R.layout.main_page)

root
ViewGroup

Optional view to be the parent of the generated hierarchy.

Returns

The root View of the inflated hierarchy. If root was supplied, this is the root View; otherwise it is the root of the inflated XML file.

Attributes

Remarks

Inflate a new view hierarchy from the specified xml resource. Throws InflateException if there is an error.

Java documentation for android.view.LayoutInflater.inflate(int, android.view.ViewGroup).

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

Inflate(XmlReader, ViewGroup)

Inflate a new view hierarchy from the specified xml node.

[Android.Runtime.Register("inflate", "(Lorg/xmlpull/v1/XmlPullParser;Landroid/view/ViewGroup;)Landroid/view/View;", "GetInflate_Lorg_xmlpull_v1_XmlPullParser_Landroid_view_ViewGroup_Handler")]
public virtual Android.Views.View? Inflate (System.Xml.XmlReader? parser, Android.Views.ViewGroup? root);
[<Android.Runtime.Register("inflate", "(Lorg/xmlpull/v1/XmlPullParser;Landroid/view/ViewGroup;)Landroid/view/View;", "GetInflate_Lorg_xmlpull_v1_XmlPullParser_Landroid_view_ViewGroup_Handler")>]
abstract member Inflate : System.Xml.XmlReader * Android.Views.ViewGroup -> Android.Views.View
override this.Inflate : System.Xml.XmlReader * Android.Views.ViewGroup -> Android.Views.View

Parameters

parser
XmlReader

XML dom node containing the description of the view hierarchy.

root
ViewGroup

Optional view to be the parent of the generated hierarchy.

Returns

The root View of the inflated hierarchy. If root was supplied, this is the root View; otherwise it is the root of the inflated XML file.

Attributes

Remarks

Inflate a new view hierarchy from the specified xml node. Throws InflateException if there is an error. *

<em><strong>Important</strong></em>&nbsp;&nbsp;&nbsp;For performance reasons, view inflation relies heavily on pre-processing of XML files that is done at build time. Therefore, it is not currently possible to use LayoutInflater with an XmlPullParser over a plain XML file at runtime.

Java documentation for android.view.LayoutInflater.inflate(org.xmlpull.v1.XmlPullParser, android.view.ViewGroup).

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

Inflate(Int32, ViewGroup, Boolean)

Inflate a new view hierarchy from the specified xml resource.

[Android.Runtime.Register("inflate", "(ILandroid/view/ViewGroup;Z)Landroid/view/View;", "GetInflate_ILandroid_view_ViewGroup_ZHandler")]
public virtual Android.Views.View? Inflate (int resource, Android.Views.ViewGroup? root, bool attachToRoot);
[<Android.Runtime.Register("inflate", "(ILandroid/view/ViewGroup;Z)Landroid/view/View;", "GetInflate_ILandroid_view_ViewGroup_ZHandler")>]
abstract member Inflate : int * Android.Views.ViewGroup * bool -> Android.Views.View
override this.Inflate : int * Android.Views.ViewGroup * bool -> Android.Views.View

Parameters

resource
Int32

ID for an XML layout resource to load (e.g., R.layout.main_page)

root
ViewGroup

Optional view to be the parent of the generated hierarchy (if <em>attachToRoot</em> is true), or else simply an object that provides a set of LayoutParams values for root of the returned hierarchy (if <em>attachToRoot</em> is false.)

attachToRoot
Boolean

Whether the inflated hierarchy should be attached to the root parameter? If false, root is only used to create the correct subclass of LayoutParams for the root view in the XML.

Returns

The root View of the inflated hierarchy. If root was supplied and attachToRoot is true, this is root; otherwise it is the root of the inflated XML file.

Attributes

Remarks

Inflate a new view hierarchy from the specified xml resource. Throws InflateException if there is an error.

Java documentation for android.view.LayoutInflater.inflate(int, android.view.ViewGroup, boolean).

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

Inflate(XmlReader, ViewGroup, Boolean)

Inflate a new view hierarchy from the specified XML node.

[Android.Runtime.Register("inflate", "(Lorg/xmlpull/v1/XmlPullParser;Landroid/view/ViewGroup;Z)Landroid/view/View;", "GetInflate_Lorg_xmlpull_v1_XmlPullParser_Landroid_view_ViewGroup_ZHandler")]
public virtual Android.Views.View? Inflate (System.Xml.XmlReader? parser, Android.Views.ViewGroup? root, bool attachToRoot);
[<Android.Runtime.Register("inflate", "(Lorg/xmlpull/v1/XmlPullParser;Landroid/view/ViewGroup;Z)Landroid/view/View;", "GetInflate_Lorg_xmlpull_v1_XmlPullParser_Landroid_view_ViewGroup_ZHandler")>]
abstract member Inflate : System.Xml.XmlReader * Android.Views.ViewGroup * bool -> Android.Views.View
override this.Inflate : System.Xml.XmlReader * Android.Views.ViewGroup * bool -> Android.Views.View

Parameters

parser
XmlReader

XML dom node containing the description of the view hierarchy.

root
ViewGroup

Optional view to be the parent of the generated hierarchy (if <em>attachToRoot</em> is true), or else simply an object that provides a set of LayoutParams values for root of the returned hierarchy (if <em>attachToRoot</em> is false.)

attachToRoot
Boolean

Whether the inflated hierarchy should be attached to the root parameter? If false, root is only used to create the correct subclass of LayoutParams for the root view in the XML.

Returns

The root View of the inflated hierarchy. If root was supplied and attachToRoot is true, this is root; otherwise it is the root of the inflated XML file.

Attributes

Remarks

Inflate a new view hierarchy from the specified XML node. Throws InflateException if there is an error.

<em><strong>Important</strong></em>&nbsp;&nbsp;&nbsp;For performance reasons, view inflation relies heavily on pre-processing of XML files that is done at build time. Therefore, it is not currently possible to use LayoutInflater with an XmlPullParser over a plain XML file at runtime.

Java documentation for android.view.LayoutInflater.inflate(org.xmlpull.v1.XmlPullParser, android.view.ViewGroup, boolean).

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