MaterialContainerTransform

public final class MaterialContainerTransform
extends Transition

java.lang.Object
   ↳ androidx.transition.Transition
     ↳ com.google.android.material.transition.MaterialContainerTransform


A shared element Transition that transforms one container to another.

MaterialContainerTransform can be used to morph between two Activities, Fragments, Views or a View to a Fragment.

This transition captures a start and end View which are used to create a Drawable which will be added to the view hierarchy. The drawable will be added to the view hierarchy as an overlay and handles drawing a mask that morphs between the shape of the start View to the shape of the end View. During the animation, the start and end View's are drawn inside the masking container and faded in and/or out over a duration of the transition. Additionally, the masking container will be translated and scaled from the position and size of the start View to the position and size of the end View.

MaterialContainerTransform supports theme-based easing, duration, and path values. In order to have the transition load these values upfront, use the MaterialContainerTransform(Context, boolean) constructor. Otherwise, use the default constructor and the transition will load theme values from the View context before it runs, and only use them if the corresponding properties weren't already set on the transition instance.

The composition of MaterialContainerTransform's animation can be customized in a number of ways. The two most prominent customizations are the way in which content inside the container is swapped via setFadeMode(int) and path the container follows from its starting position to its ending position via setPathMotion(PathMotion). For other ways to customize the container transform, see:

Summary

Nested classes

class MaterialContainerTransform.ProgressThresholds

A class which holds a start and end value which represent a range within 0.0 - 1.0. 

Constants

int FADE_MODE_CROSS

Indicates that this transition should cross fade the outgoing and incoming content.

int FADE_MODE_IN

Indicates that this transition should only fade in the incoming content, without changing the opacity of the outgoing content.

int FADE_MODE_OUT

Indicates that this transition should only fade out the outgoing content, without changing the opacity of the incoming content.

int FADE_MODE_THROUGH

Indicates that this transition should sequentially fade out the outgoing content and fade in the incoming content.

int FIT_MODE_AUTO

Indicates that this transition should automatically choose whether to use FIT_MODE_WIDTH or FIT_MODE_HEIGHT.

int FIT_MODE_HEIGHT

Indicates that this transition should fit the incoming content to the height of the outgoing content during the scale animation.

int FIT_MODE_WIDTH

Indicates that this transition should fit the incoming content to the width of the outgoing content during the scale animation.

int TRANSITION_DIRECTION_AUTO

Indicates that this transition should use automatic detection to determine whether it is an Enter or a Return.

int TRANSITION_DIRECTION_ENTER

Indicates that this is an Enter transition, i.e., when elements are entering the scene.

int TRANSITION_DIRECTION_RETURN

Indicates that this is a Return transition, i.e., when elements are exiting the scene.

Inherited constants

Public constructors

MaterialContainerTransform()
MaterialContainerTransform(Context context, boolean entering)

Public methods

void captureEndValues(TransitionValues transitionValues)
void captureStartValues(TransitionValues transitionValues)
Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues)
int getContainerColor()

Get the color to be drawn beneath both the start view and end view.

int getDrawingViewId()

Get the id of the View whose overlay this transitions will be added to.

int getEndContainerColor()

Get the color to be drawn beneath the end view.

float getEndElevation()

Get the elevation that will be used to render a shadow around the container at the end of the transition.

ShapeAppearanceModel getEndShapeAppearanceModel()

Get the ShapeAppearanceModel which will be used to determine the shape into which the container will be transformed.

View getEndView()

Get the View which will be used as the end shared element container.

int getEndViewId()

Get the id of the View which will be used as the end shared element container.

int getFadeMode()

The fade mode to be used to swap the content of the start View with that of the end View.

MaterialContainerTransform.ProgressThresholds getFadeProgressThresholds()

Get the MaterialContainerTransform.ProgressThresholds which define the sub-range (any range inside the full progress range of 0.0 - 1.0) between which the fade animation, determined by getFadeMode() will complete.

int getFitMode()

The fit mode to be used when scaling the incoming content of the end View.

MaterialContainerTransform.ProgressThresholds getScaleMaskProgressThresholds()

Get the MaterialContainerTransform.ProgressThresholds which define the sub-range (any range inside the full progress range of 0.0 and 1.0) between which the container will morph between the start and end View's dimensions.

MaterialContainerTransform.ProgressThresholds getScaleProgressThresholds()

Get the MaterialContainerTransform.ProgressThresholds which define the sub-range (any range inside the full progress range of 0.0 - 1.0) between which the outgoing and incoming content will scale to the full dimensions of the end container.

int getScrimColor()

Get the color to be drawn under the morphing container but within the bounds of the getDrawingViewId().

MaterialContainerTransform.ProgressThresholds getShapeMaskProgressThresholds()

Get the MaterialContainerTransform.ProgressThresholds which define the sub-range (any range inside the full progress range of 0.0 and 1.0) between which the container will morph between the starting ShapeAppearanceModel and ending ShapeAppearanceModel.

int getStartContainerColor()

Get the color to be drawn beneath the start view.

float getStartElevation()

Get the elevation that will be used to render a shadow around the container at the start of the transition.

ShapeAppearanceModel getStartShapeAppearanceModel()

Get the ShapeAppearanceModel which will be used to determine the shape from which the container will be transformed.

View getStartView()

Get the View which will be used as the start shared element container.

int getStartViewId()

Get the id of the View which will be used as the start shared element container.

int getTransitionDirection()

The direction to be used by this transform.

String[] getTransitionProperties()
boolean isDrawDebugEnabled()

Whether debug drawing is enabled.

boolean isElevationShadowEnabled()

Get whether shadows should be drawn around the container to approximate native elevation shadows on the start and end views.

boolean isHoldAtEndEnabled()

Whether to hold the last frame at the end of the animation.

void setAllContainerColors(int containerColor)

Set the container color, the start container color and the end container color.

void setContainerColor(int containerColor)

Set a color to be drawn beneath both the start and end view.

void setDrawDebugEnabled(boolean drawDebugEnabled)

Set whether or not to draw paths which follow the shape and path of animating containers.

void setDrawingViewId(int drawingViewId)

Set the id of the View whose overlay this transition will be added to.

void setElevationShadowEnabled(boolean elevationShadowEnabled)

Set whether shadows should be drawn around the container to approximate native elevation shadows on the start and end views.

void setEndContainerColor(int containerColor)

Set a color to be drawn beneath the end view.

void setEndElevation(float endElevation)

Set the elevation that will be used to render a shadow around the container at the end of the transition.

void setEndShapeAppearanceModel(ShapeAppearanceModel endShapeAppearanceModel)

Set the ShapeAppearanceModel which will be used to determine the shape into which the container will be transformed.

void setEndView(View endView)

Set the View to be used as the end shared element container.

void setEndViewId(int endViewId)

Set the id of the View to be used as the end shared element container.

void setFadeMode(int fadeMode)

Set the fade mode to be used to swap the content of the start View with that of the end View.

void setFadeProgressThresholds(MaterialContainerTransform.ProgressThresholds fadeProgressThresholds)

Set the MaterialContainerTransform.ProgressThresholds which define the sub-range (any range inside the full progress range of 0.0 - 1.0) between which the fade animation, determined by getFadeMode() will complete.

void setFitMode(int fitMode)

Set the fit mode to be used when scaling the incoming content of the end View.

void setHoldAtEndEnabled(boolean holdAtEndEnabled)

If true, the last frame of the animation will be held in place, and the original outgoing and incoming views will not be re-shown.

void setPathMotion(PathMotion pathMotion)
void setScaleMaskProgressThresholds(MaterialContainerTransform.ProgressThresholds scaleMaskProgressThresholds)

Set the MaterialContainerTransform.ProgressThresholds which define the sub-range (any range inside the full progress range of 0.0 and 1.0) between which the container will morph between the start and end View's dimensions.

void setScaleProgressThresholds(MaterialContainerTransform.ProgressThresholds scaleProgressThresholds)

Set the MaterialContainerTransform.ProgressThresholds which define the sub-range (any range inside the full progress range of 0.0 - 1.0) between which the outgoing and incoming content will scale to the full dimensions of the end container.

void setScrimColor(int scrimColor)

Set the color to be drawn under the morphing container but within the bounds of the getDrawingViewId().

void setShapeMaskProgressThresholds(MaterialContainerTransform.ProgressThresholds shapeMaskProgressThresholds)

Set the MaterialContainerTransform.ProgressThresholds which define the sub-range (any range inside the full progress range of 0.0 and 1.0) between which the container will morph between the starting ShapeAppearanceModel and ending ShapeAppearanceModel.

void setStartContainerColor(int containerColor)

Set a color to be drawn beneath the start view.

void setStartElevation(float startElevation)

Set the elevation that will be used to render a shadow around the container at the start of the transition.

void setStartShapeAppearanceModel(ShapeAppearanceModel startShapeAppearanceModel)

Set the ShapeAppearanceModel which will be used to determine the shape from which the container will be transformed.

void setStartView(View startView)

Set the View to be used as the start shared element container.

void setStartViewId(int startViewId)

Set the id of the View to be used as the start shared element container.

void setTransitionDirection(int transitionDirection)

Set the transition direction to be used by this transform.

Inherited methods

Constants

FADE_MODE_CROSS

public static final int FADE_MODE_CROSS

Indicates that this transition should cross fade the outgoing and incoming content.

Constant Value: 2 (0x00000002)

FADE_MODE_IN

public static final int FADE_MODE_IN

Indicates that this transition should only fade in the incoming content, without changing the opacity of the outgoing content.

Constant Value: 0 (0x00000000)

FADE_MODE_OUT

public static final int FADE_MODE_OUT

Indicates that this transition should only fade out the outgoing content, without changing the opacity of the incoming content.

Constant Value: 1 (0x00000001)

FADE_MODE_THROUGH

public static final int FADE_MODE_THROUGH

Indicates that this transition should sequentially fade out the outgoing content and fade in the incoming content.

Constant Value: 3 (0x00000003)

FIT_MODE_AUTO

public static final int FIT_MODE_AUTO

Indicates that this transition should automatically choose whether to use FIT_MODE_WIDTH or FIT_MODE_HEIGHT.

Constant Value: 0 (0x00000000)

FIT_MODE_HEIGHT

public static final int FIT_MODE_HEIGHT

Indicates that this transition should fit the incoming content to the height of the outgoing content during the scale animation.

Constant Value: 2 (0x00000002)

FIT_MODE_WIDTH

public static final int FIT_MODE_WIDTH

Indicates that this transition should fit the incoming content to the width of the outgoing content during the scale animation.

Constant Value: 1 (0x00000001)

TRANSITION_DIRECTION_AUTO

public static final int TRANSITION_DIRECTION_AUTO

Indicates that this transition should use automatic detection to determine whether it is an Enter or a Return. If the end container has a larger area than the start container then it is considered an Enter transition, otherwise it is a Return transition.

Constant Value: 0 (0x00000000)

TRANSITION_DIRECTION_ENTER

public static final int TRANSITION_DIRECTION_ENTER

Indicates that this is an Enter transition, i.e., when elements are entering the scene.

Constant Value: 1 (0x00000001)

TRANSITION_DIRECTION_RETURN

public static final int TRANSITION_DIRECTION_RETURN

Indicates that this is a Return transition, i.e., when elements are exiting the scene.

Constant Value: 2 (0x00000002)

Public constructors

MaterialContainerTransform

public MaterialContainerTransform ()

MaterialContainerTransform

public MaterialContainerTransform (Context context, 
                boolean entering)

Parameters
context Context

entering boolean

Public methods

captureEndValues

public void captureEndValues (TransitionValues transitionValues)

Parameters
transitionValues TransitionValues

captureStartValues

public void captureStartValues (TransitionValues transitionValues)

Parameters
transitionValues TransitionValues

createAnimator

public Animator createAnimator (ViewGroup sceneRoot, 
                TransitionValues startValues, 
                TransitionValues endValues)

Parameters
sceneRoot ViewGroup

startValues TransitionValues

endValues TransitionValues

Returns
Animator

getContainerColor

public int getContainerColor ()

Get the color to be drawn beneath both the start view and end view.

Returns
int

getDrawingViewId

public int getDrawingViewId ()

Get the id of the View whose overlay this transitions will be added to.

Returns
int

getEndContainerColor

public int getEndContainerColor ()

Get the color to be drawn beneath the end view.

Returns
int

getEndElevation

public float getEndElevation ()

Get the elevation that will be used to render a shadow around the container at the end of the transition.

Default is -1, which means the elevation of the end view will be used.

Returns
float

getEndShapeAppearanceModel

public ShapeAppearanceModel getEndShapeAppearanceModel ()

Get the ShapeAppearanceModel which will be used to determine the shape into which the container will be transformed.

Returns
ShapeAppearanceModel

getEndView

public View getEndView ()

Get the View which will be used as the end shared element container.

Returns
View

getEndViewId

public int getEndViewId ()

Get the id of the View which will be used as the end shared element container.

Setting an end View id can be used to manually configure MaterialContainerTransform when transitioning between two Views in a single layout when the Transition system will not automatically capture shared element start or end Views for you.

If the end view cannot be found during the initialization of the MaterialContainerTransform, then an IllegalArgumentException will be thrown.

Returns
int

getFadeMode

public int getFadeMode ()

The fade mode to be used to swap the content of the start View with that of the end View.

Returns
int

getFadeProgressThresholds

public MaterialContainerTransform.ProgressThresholds getFadeProgressThresholds ()

Get the MaterialContainerTransform.ProgressThresholds which define the sub-range (any range inside the full progress range of 0.0 - 1.0) between which the fade animation, determined by getFadeMode() will complete.

Returns
MaterialContainerTransform.ProgressThresholds

getFitMode

public int getFitMode ()

The fit mode to be used when scaling the incoming content of the end View.

Returns
int

getScaleMaskProgressThresholds

public MaterialContainerTransform.ProgressThresholds getScaleMaskProgressThresholds ()

Get the MaterialContainerTransform.ProgressThresholds which define the sub-range (any range inside the full progress range of 0.0 and 1.0) between which the container will morph between the start and end View's dimensions.

Returns
MaterialContainerTransform.ProgressThresholds

getScaleProgressThresholds

public MaterialContainerTransform.ProgressThresholds getScaleProgressThresholds ()

Get the MaterialContainerTransform.ProgressThresholds which define the sub-range (any range inside the full progress range of 0.0 - 1.0) between which the outgoing and incoming content will scale to the full dimensions of the end container.

Returns
MaterialContainerTransform.ProgressThresholds

getScrimColor

public int getScrimColor ()

Get the color to be drawn under the morphing container but within the bounds of the getDrawingViewId().

Returns
int

getShapeMaskProgressThresholds

public MaterialContainerTransform.ProgressThresholds getShapeMaskProgressThresholds ()

Get the MaterialContainerTransform.ProgressThresholds which define the sub-range (any range inside the full progress range of 0.0 and 1.0) between which the container will morph between the starting ShapeAppearanceModel and ending ShapeAppearanceModel.

Returns
MaterialContainerTransform.ProgressThresholds

getStartContainerColor

public int getStartContainerColor ()

Get the color to be drawn beneath the start view.

Returns
int

getStartElevation

public float getStartElevation ()

Get the elevation that will be used to render a shadow around the container at the start of the transition.

Default is -1, which means the elevation of the start view will be used.

Returns
float

getStartShapeAppearanceModel

public ShapeAppearanceModel getStartShapeAppearanceModel ()

Get the ShapeAppearanceModel which will be used to determine the shape from which the container will be transformed.

Returns
ShapeAppearanceModel

getStartView

public View getStartView ()

Get the View which will be used as the start shared element container.

Returns
View

getStartViewId

public int getStartViewId ()

Get the id of the View which will be used as the start shared element container.

Returns
int

getTransitionDirection

public int getTransitionDirection ()

The direction to be used by this transform.

Returns
int

getTransitionProperties

public String[] getTransitionProperties ()

Returns
String[]

isDrawDebugEnabled

public boolean isDrawDebugEnabled ()

Whether debug drawing is enabled.

Returns
boolean

isElevationShadowEnabled

public boolean isElevationShadowEnabled ()

Get whether shadows should be drawn around the container to approximate native elevation shadows on the start and end views.

Returns
boolean

isHoldAtEndEnabled

public boolean isHoldAtEndEnabled ()

Whether to hold the last frame at the end of the animation.

Returns
boolean

setAllContainerColors

public void setAllContainerColors (int containerColor)

Set the container color, the start container color and the end container color.

This is a helper for the common case of transitioning between a start and end view when neither draws its own background but a common color is shared. This prevents the start or end view from being visible below one another.

Parameters
containerColor int

setContainerColor

public void setContainerColor (int containerColor)

Set a color to be drawn beneath both the start and end view.

This color is the background color of the transforming container inside of which the start and end views are drawn. Unlike the start view, start container color, end view and end container color, this color will always be drawn as fully opaque, beneath all other content in the container. By default, this color is set to transparent (0), meaning a container color will not be drawn.

If a default container transform results in the start view being visible beneath the end view, or vica versa, this is due to one or both views not having a background. The most common way to solve this issue is by sequentially fading the contents with FADE_MODE_THROUGH and setting this color to the start and end view's desired background color.

If the start and end views have different background colors, or you would like to use a fade mode other than FADE_MODE_THROUGH, handle this by using setStartContainerColor(int) and setEndContainerColor(int).

Parameters
containerColor int

setDrawDebugEnabled

public void setDrawDebugEnabled (boolean drawDebugEnabled)

Set whether or not to draw paths which follow the shape and path of animating containers.

Parameters
drawDebugEnabled boolean: true if debugging lines and borders should be drawn during animation.

setDrawingViewId

public void setDrawingViewId (int drawingViewId)

Set the id of the View whose overlay this transition will be added to.

This can be used to limit the bounds of the animation (including the background scrim) to the bounds of the provided drawing view, and also have the animation drawn at the relative z-order of the drawing view.

By default, the drawingViewId will be android.R.id.content. Additionally, if drawingViewId is the same as the end View's id, MaterialContainerTransform will add the transition's drawable to the drawingViewId's parent instead.

If the drawing view cannot be found during the initialization of the MaterialContainerTransform, then an IllegalArgumentException will be thrown.

Parameters
drawingViewId int

setElevationShadowEnabled

public void setElevationShadowEnabled (boolean elevationShadowEnabled)

Set whether shadows should be drawn around the container to approximate native elevation shadows on the start and end views.

By default, the elevation shadows are only enabled for API level 28 and above, because Paint shadows are not supported with hardware acceleration below API level 28. If enabled for below API level 28, then the shadows will be drawn using MaterialShapeDrawable, however this may cause performance issues.

Additionally, the rendering of elevation shadows may cause performance issues if the container's shape is not a round rect or a regular rect, e.g., a rect with cut corners.

Parameters
elevationShadowEnabled boolean

setEndContainerColor

public void setEndContainerColor (int containerColor)

Set a color to be drawn beneath the end view.

This color will be drawn directly beneath the end view, will fill the entire transforming container, and the will animate its opacity to match the end view's. By default, this color is set to transparent (0), meaning no color will be drawn.

This method can be useful when the color of the start and end view differ and the end view does not handle drawing its own background. Setting this color will prevent the start view from being visible beneath the end view while transforming.

Parameters
containerColor int

setEndElevation

public void setEndElevation (float endElevation)

Set the elevation that will be used to render a shadow around the container at the end of the transition.

By default the elevation of the end view will be used.

Parameters
endElevation float

setEndShapeAppearanceModel

public void setEndShapeAppearanceModel (ShapeAppearanceModel endShapeAppearanceModel)

Set the ShapeAppearanceModel which will be used to determine the shape into which the container will be transformed.

Parameters
endShapeAppearanceModel ShapeAppearanceModel

setEndView

public void setEndView (View endView)

Set the View to be used as the end shared element container.

Parameters
endView View

See also:

setEndViewId

public void setEndViewId (int endViewId)

Set the id of the View to be used as the end shared element container. The matching View will be searched for in the hierarchy when starting this transition.

Manually setting the end View id will override any View explicitly set via setEndView(View) or any View picked up by the Transition system marked with a transitionName.

Parameters
endViewId int

setFadeMode

public void setFadeMode (int fadeMode)

Set the fade mode to be used to swap the content of the start View with that of the end View.

By default, the fade mode is set to FADE_MODE_IN.

Parameters
fadeMode int

setFadeProgressThresholds

public void setFadeProgressThresholds (MaterialContainerTransform.ProgressThresholds fadeProgressThresholds)

Set the MaterialContainerTransform.ProgressThresholds which define the sub-range (any range inside the full progress range of 0.0 - 1.0) between which the fade animation, determined by getFadeMode() will complete.

See MaterialContainerTransform.ProgressThresholds for an example of how the threshold ranges work.

Parameters
fadeProgressThresholds MaterialContainerTransform.ProgressThresholds

setFitMode

public void setFitMode (int fitMode)

Set the fit mode to be used when scaling the incoming content of the end View.

By default, the fit mode is set to FIT_MODE_AUTO.

Parameters
fitMode int

setHoldAtEndEnabled

public void setHoldAtEndEnabled (boolean holdAtEndEnabled)

If true, the last frame of the animation will be held in place, and the original outgoing and incoming views will not be re-shown.

Useful for Activity return transitions to make sure the screen doesn't flash at the end.

Parameters
holdAtEndEnabled boolean

setPathMotion

public void setPathMotion (PathMotion pathMotion)

Parameters
pathMotion PathMotion

setScaleMaskProgressThresholds

public void setScaleMaskProgressThresholds (MaterialContainerTransform.ProgressThresholds scaleMaskProgressThresholds)

Set the MaterialContainerTransform.ProgressThresholds which define the sub-range (any range inside the full progress range of 0.0 and 1.0) between which the container will morph between the start and end View's dimensions.

See MaterialContainerTransform.ProgressThresholds for an example of how the threshold ranges work.

Parameters
scaleMaskProgressThresholds MaterialContainerTransform.ProgressThresholds

setScaleProgressThresholds

public void setScaleProgressThresholds (MaterialContainerTransform.ProgressThresholds scaleProgressThresholds)

Set the MaterialContainerTransform.ProgressThresholds which define the sub-range (any range inside the full progress range of 0.0 - 1.0) between which the outgoing and incoming content will scale to the full dimensions of the end container.

See MaterialContainerTransform.ProgressThresholds for an example of how the threshold ranges work.

Parameters
scaleProgressThresholds MaterialContainerTransform.ProgressThresholds

setScrimColor

public void setScrimColor (int scrimColor)

Set the color to be drawn under the morphing container but within the bounds of the getDrawingViewId().

By default this is set to black with 32% opacity. Drawing a scrim is primarily useful for transforming from a partial-screen View (eg. Card in a grid) to a full screen. The scrim will gradually fade in and cover the content being transformed over by the morphing container.

Changing the default scrim color can be useful when transitioning between two Views in a layout, where the ending View does not cover any outgoing content (eg. a FAB to a bottom toolbar). For scenarios such as these, set the scrim color to transparent.

Parameters
scrimColor int

setShapeMaskProgressThresholds

public void setShapeMaskProgressThresholds (MaterialContainerTransform.ProgressThresholds shapeMaskProgressThresholds)

Set the MaterialContainerTransform.ProgressThresholds which define the sub-range (any range inside the full progress range of 0.0 and 1.0) between which the container will morph between the starting ShapeAppearanceModel and ending ShapeAppearanceModel.

See MaterialContainerTransform.ProgressThresholds for an example of how the threshold ranges work.

Parameters
shapeMaskProgressThresholds MaterialContainerTransform.ProgressThresholds

setStartContainerColor

public void setStartContainerColor (int containerColor)

Set a color to be drawn beneath the start view.

This color will be drawn directly beneath the start view, will fill the entire transforming container, and will animate its opacity to match the start view's. By default, this color is set to transparent (0), meaning no color will be drawn.

This method can be useful when the color of the start and end view differ and the start view does not handle drawing its own background. This can also be used if an expanding container is larger than the start view. Setting this color to match that of the start view's background will cause the start view to look like its background is expanding to fill the transforming container.

Parameters
containerColor int

setStartElevation

public void setStartElevation (float startElevation)

Set the elevation that will be used to render a shadow around the container at the start of the transition.

By default the elevation of the start view will be used.

Parameters
startElevation float

setStartShapeAppearanceModel

public void setStartShapeAppearanceModel (ShapeAppearanceModel startShapeAppearanceModel)

Set the ShapeAppearanceModel which will be used to determine the shape from which the container will be transformed.

Manually setting a shape appearance will override both your theme's transitionShapeAppearance attribute (if set) and the shape appearance of the start View (or end View via setEndShapeAppearanceModel(ShapeAppearanceModel) if the View implements the Shapeable interface. Setting this property can be useful if your start or end View does not implement Shapeable but does have a shape (eg. a rounded rect background drawable) and you would like MaterialContainerTransform to morph from or to your View's shape.

Parameters
startShapeAppearanceModel ShapeAppearanceModel

setStartView

public void setStartView (View startView)

Set the View to be used as the start shared element container.

Parameters
startView View

setStartViewId

public void setStartViewId (int startViewId)

Set the id of the View to be used as the start shared element container. The matching View will be searched for in the hierarchy when starting this transition.

Setting a start View can be helpful when transitioning from a View to another View or if transitioning from a View to a Fragment.

Manually setting the start View id will override any View explicitly set via setStartView(View) or any View picked up by the Transition system marked with a transitionName.

If the start view cannot be found during the initialization of the MaterialContainerTransform, then an IllegalArgumentException will be thrown.

Parameters
startViewId int

setTransitionDirection

public void setTransitionDirection (int transitionDirection)

Set the transition direction to be used by this transform.

By default, the transition direction is determined by the change in size between the start and end Views.

Parameters
transitionDirection int