Share via


SharedElementCallback.OnSharedElementEnd Method

Definition

In Activity Transitions, onSharedElementEnd is called immediately before capturing the end of the shared element state on enter and reenter transitions and immediately before capturing the start of the shared element state for exit and return transitions.

[Android.Runtime.Register("onSharedElementEnd", "(Ljava/util/List;Ljava/util/List;Ljava/util/List;)V", "GetOnSharedElementEnd_Ljava_util_List_Ljava_util_List_Ljava_util_List_Handler")]
public virtual void OnSharedElementEnd (System.Collections.Generic.IList<string>? sharedElementNames, System.Collections.Generic.IList<Android.Views.View>? sharedElements, System.Collections.Generic.IList<Android.Views.View>? sharedElementSnapshots);
[<Android.Runtime.Register("onSharedElementEnd", "(Ljava/util/List;Ljava/util/List;Ljava/util/List;)V", "GetOnSharedElementEnd_Ljava_util_List_Ljava_util_List_Ljava_util_List_Handler")>]
abstract member OnSharedElementEnd : System.Collections.Generic.IList<string> * System.Collections.Generic.IList<Android.Views.View> * System.Collections.Generic.IList<Android.Views.View> -> unit
override this.OnSharedElementEnd : System.Collections.Generic.IList<string> * System.Collections.Generic.IList<Android.Views.View> * System.Collections.Generic.IList<Android.Views.View> -> unit

Parameters

sharedElementNames
IList<String>

The names of the shared elements that were accepted into the View hierarchy.

sharedElements
IList<View>

The shared elements that are part of the View hierarchy.

sharedElementSnapshots
IList<View>

The Views containing snap shots of the shared element from the launching Window. These elements will not be part of the scene, but will be positioned relative to the Window decor View. This list will be null for Fragment Transitions.

Attributes

Remarks

In Activity Transitions, onSharedElementEnd is called immediately before capturing the end of the shared element state on enter and reenter transitions and immediately before capturing the start of the shared element state for exit and return transitions.

In Fragment Transitions, onSharedElementEnd is called immediately before capturing the end state of all shared element transitions.

This call can be used to adjust the transition end state by modifying the shared element Views. Note that no layout step will be executed between onSharedElementEnd and the transition state capture.

Any changes made in #onSharedElementStart(List, List, List) that are not updated during layout should be corrected in onSharedElementEnd. For example, rotation or scale will not be affected by layout and if changed in #onSharedElementStart(List, List, List), it will also have to be reset in onSharedElementEnd again to correct the end state.

Java documentation for android.app.SharedElementCallback.onSharedElementEnd(java.util.List<java.lang.String>, java.util.List<android.view.View>, java.util.List<android.view.View>).

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