Språk

Fragment.OnCreateView(LayoutInflater, ViewGroup, Bundle) Method

Definition

Called to have the fragment instantiate its user interface view.

[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 Android.Views.View? OnCreateView(Android.Views.LayoutInflater? inflater, Android.Views.ViewGroup? container, Android.OS.Bundle? savedInstanceState);
[<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")>]
abstract member OnCreateView : Android.Views.LayoutInflater * Android.Views.ViewGroup * Android.OS.Bundle -> Android.Views.View
override this.OnCreateView : Android.Views.LayoutInflater * Android.Views.ViewGroup * Android.OS.Bundle -> Android.Views.View

Parameters

inflater
LayoutInflater

The LayoutInflater object that can be used to inflate any views in the fragment,

container
ViewGroup

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
Bundle

If non-null, this fragment is being re-constructed from a previous saved state as given here.

Returns

Return the View for the fragment's UI, or null.

Attributes

Remarks

Called to create the fragment's user interface view. This is optional; the default implementation returns null. It is called after initial creation and before OnActivityCreated(Bundle). A retained instance can recreate its view without another OnCreate(Bundle) call. If this method returns a view, OnDestroyView() is called when the view is released.

Android reference for android.app.Fragment.onCreateView.

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