Android Guides | Samples

Android.App.Fragment.OnCreateView Method

Called to have the fragment instantiate its user interface view.

Syntax

[Android.Runtime.Register("onCreateView", "(Landroid/view/LayoutInflater;Landroid/view/ViewGroup;Landroid/os/Bundle;)Landroid/view/View;", "GetOnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_Handler")]
public virtual View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)

Parameters

inflater
The LayoutInflater object that can be used to inflate any views in the fragment,
container
If non-null, this is the parent view that the fragment's UI should be attached to. The fragment should not add the view itself, but this can be used to generate the LayoutParams of the view.
savedInstanceState
If non-null, this fragment is being re-constructed from a previous saved state as given here.

Remarks

Called to have the fragment instantiate its user interface view. This is optional, and non-graphical fragments can return null (which is the default implementation). This will be called between Fragment.OnCreate(Bundle) and Fragment.OnActivityCreated(Bundle).

If you return a View from here, you will later be called in Fragment.OnDestroyView when the view is being released.

[Android Documentation]

Requirements

Namespace: Android.App
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 11