Activity.OverrideActivityTransition Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| OverrideActivityTransition(OverrideTransition, Int32, Int32, Int32) |
Customizes the animation and background color for activity transitions. |
| OverrideActivityTransition(OverrideTransition, Int32, Int32) |
Customizes the animation for activity transitions. |
OverrideActivityTransition(OverrideTransition, Int32, Int32, Int32)
Customizes the animation and background color for activity transitions.
[Android.Runtime.Register("overrideActivityTransition", "(IIII)V", "GetOverrideActivityTransition_IIIIHandler", ApiSince=34)]
public virtual void OverrideActivityTransition(Android.App.OverrideTransition overrideType, int enterAnim, int exitAnim, int backgroundColor);
[<Android.Runtime.Register("overrideActivityTransition", "(IIII)V", "GetOverrideActivityTransition_IIIIHandler", ApiSince=34)>]
abstract member OverrideActivityTransition : Android.App.OverrideTransition * int * int * int -> unit
override this.OverrideActivityTransition : Android.App.OverrideTransition * int * int * int -> unit
Parameters
- overrideType
- OverrideTransition
int: The type of transition to override. Must be either OVERRIDE_TRANSITION_OPEN for entering transitions or OVERRIDE_TRANSITION_CLOSE for exiting transitions. Value is one of the following: OVERRIDE_TRANSITION_OPEN OVERRIDE_TRANSITION_CLOSE
- enterAnim
- Int32
int: The resource ID of the animation for the incoming activity. Use 0 for no animation.
- exitAnim
- Int32
int: The resource ID of the animation for the outgoing activity. Use 0 for no animation.
- backgroundColor
- Int32
int: The background color to display during the animation. Set to Color.TRANSPARENT to use the default background color.
- Attributes
Remarks
Customizes the animation and background color for activity transitions. This method provides a robust way to override transition animations at runtime and can be called at any point in the activity's lifecycle. It is particularly useful for handling predictive back animations, for which overridePendingTransition(int, int) is not suitable.
The specified animations will be applied only when this activity is at the top of the task stack during the transition. For example, to customize the opening animation for an Activity B started from Activity A, call this method in B's onCreate with overrideType = OVERRIDE_TRANSITION_OPEN. To customize the closing animation when returning from B to A, call this method in B with overrideType = OVERRIDE_TRANSITION_CLOSE.
Animation Precedence:
Predictive Back Animation:
When predictive back is enabled (see enableOnBackInvokedCallback in the manifest), the system may control the preview phase of the back animation. The custom transition defined by enterAnim and exitAnim is then applied only after the back gesture is committed.
Limitations:
See also:
Android reference for android.app.Activity.overrideActivityTransition.
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
OverrideActivityTransition(OverrideTransition, Int32, Int32)
Customizes the animation for activity transitions.
[Android.Runtime.Register("overrideActivityTransition", "(III)V", "GetOverrideActivityTransition_IIIHandler", ApiSince=34)]
public virtual void OverrideActivityTransition(Android.App.OverrideTransition overrideType, int enterAnim, int exitAnim);
[<Android.Runtime.Register("overrideActivityTransition", "(III)V", "GetOverrideActivityTransition_IIIHandler", ApiSince=34)>]
abstract member OverrideActivityTransition : Android.App.OverrideTransition * int * int -> unit
override this.OverrideActivityTransition : Android.App.OverrideTransition * int * int -> unit
Parameters
- overrideType
- OverrideTransition
int: The type of transition to override. Must be either OVERRIDE_TRANSITION_OPEN for entering transitions or OVERRIDE_TRANSITION_CLOSE for exiting transitions. Value is one of the following: OVERRIDE_TRANSITION_OPEN OVERRIDE_TRANSITION_CLOSE
- enterAnim
- Int32
int: The resource ID of the animation for the incoming activity. Use 0 for no animation.
- exitAnim
- Int32
int: The resource ID of the animation for the outgoing activity. Use 0 for no animation.
- Attributes
Remarks
Customizes the animation for activity transitions. This method provides a robust way to override transition animations at runtime and can be called at any point in the activity's lifecycle. It is particularly useful for handling predictive back animations, for which overridePendingTransition(int, int) is not suitable.
The specified animations will be applied only when this activity is at the top of the task stack during the transition. For example, to customize the opening animation for an Activity B started from Activity A, call this method in B's onCreate with overrideType = OVERRIDE_TRANSITION_OPEN. To customize the closing animation when returning from B to A, call this method in B with overrideType = OVERRIDE_TRANSITION_CLOSE.
Animation Precedence:
Predictive Back Animation:
When predictive back is enabled (see enableOnBackInvokedCallback in the manifest), the system may control the preview phase of the back animation. The custom transition defined by enterAnim and exitAnim is then applied only after the back gesture is committed.
Limitations:
See also:
Android reference for android.app.Activity.overrideActivityTransition.
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.