Sdílet prostřednictvím


FragmentTransaction.Add Method

Definition

Overloads

Add(Fragment, String)

Calls #add(int, Fragment, String) with a 0 containerViewId.

Add(Int32, Fragment)

Calls #add(int, Fragment, String) with a null tag.

Add(Int32, Fragment, String)

Add a fragment to the activity state.

Add(Fragment, String)

Calls #add(int, Fragment, String) with a 0 containerViewId.

[Android.Runtime.Register("add", "(Landroid/app/Fragment;Ljava/lang/String;)Landroid/app/FragmentTransaction;", "GetAdd_Landroid_app_Fragment_Ljava_lang_String_Handler")]
public abstract Android.App.FragmentTransaction? Add (Android.App.Fragment? fragment, string? tag);
[<Android.Runtime.Register("add", "(Landroid/app/Fragment;Ljava/lang/String;)Landroid/app/FragmentTransaction;", "GetAdd_Landroid_app_Fragment_Ljava_lang_String_Handler")>]
abstract member Add : Android.App.Fragment * string -> Android.App.FragmentTransaction

Parameters

fragment
Fragment
tag
String

Returns

Attributes

Remarks

Calls #add(int, Fragment, String) with a 0 containerViewId.

Java documentation for android.app.FragmentTransaction.add(android.app.Fragment, java.lang.String).

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

Add(Int32, Fragment)

Calls #add(int, Fragment, String) with a null tag.

[Android.Runtime.Register("add", "(ILandroid/app/Fragment;)Landroid/app/FragmentTransaction;", "GetAdd_ILandroid_app_Fragment_Handler")]
public abstract Android.App.FragmentTransaction? Add (int containerViewId, Android.App.Fragment? fragment);
[<Android.Runtime.Register("add", "(ILandroid/app/Fragment;)Landroid/app/FragmentTransaction;", "GetAdd_ILandroid_app_Fragment_Handler")>]
abstract member Add : int * Android.App.Fragment -> Android.App.FragmentTransaction

Parameters

containerViewId
Int32
fragment
Fragment

Returns

Attributes

Remarks

Calls #add(int, Fragment, String) with a null tag.

Java documentation for android.app.FragmentTransaction.add(int, android.app.Fragment).

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

Add(Int32, Fragment, String)

Add a fragment to the activity state.

[Android.Runtime.Register("add", "(ILandroid/app/Fragment;Ljava/lang/String;)Landroid/app/FragmentTransaction;", "GetAdd_ILandroid_app_Fragment_Ljava_lang_String_Handler")]
public abstract Android.App.FragmentTransaction? Add (int containerViewId, Android.App.Fragment? fragment, string? tag);
[<Android.Runtime.Register("add", "(ILandroid/app/Fragment;Ljava/lang/String;)Landroid/app/FragmentTransaction;", "GetAdd_ILandroid_app_Fragment_Ljava_lang_String_Handler")>]
abstract member Add : int * Android.App.Fragment * string -> Android.App.FragmentTransaction

Parameters

containerViewId
Int32

Optional identifier of the container this fragment is to be placed in. If 0, it will not be placed in a container.

fragment
Fragment

The fragment to be added. This fragment must not already be added to the activity.

tag
String

Optional tag name for the fragment, to later retrieve the fragment with FragmentManager#findFragmentByTag(String) FragmentManager.findFragmentByTag(String).

Returns

Returns the same FragmentTransaction instance.

Attributes

Remarks

Add a fragment to the activity state. This fragment may optionally also have its view (if Fragment#onCreateView Fragment.onCreateView returns non-null) inserted into a container view of the activity.

Java documentation for android.app.FragmentTransaction.add(int, android.app.Fragment, java.lang.String).

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