共用方式為


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 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 #onCreate(Bundle) and #onActivityCreated(Bundle).

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

Java documentation for android.app.Fragment.onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle).

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