Share via


SharedElementCallback.OnSharedElementStart Method

Definition

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

[Android.Runtime.Register("onSharedElementStart", "(Ljava/util/List;Ljava/util/List;Ljava/util/List;)V", "GetOnSharedElementStart_Ljava_util_List_Ljava_util_List_Ljava_util_List_Handler")]
public virtual void OnSharedElementStart (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("onSharedElementStart", "(Ljava/util/List;Ljava/util/List;Ljava/util/List;)V", "GetOnSharedElementStart_Ljava_util_List_Ljava_util_List_Ljava_util_List_Handler")>]
abstract member OnSharedElementStart : System.Collections.Generic.IList<string> * System.Collections.Generic.IList<Android.Views.View> * System.Collections.Generic.IList<Android.Views.View> -> unit
override this.OnSharedElementStart : 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 is null for Fragment Transitions.

Attributes

Remarks

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

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

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

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

Java documentation for android.app.SharedElementCallback.onSharedElementStart(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