Google 致力于为黑人社区推动种族平等。查看具体举措

ScaleProvider

public final class ScaleProvider
extends Object implements VisibilityAnimatorProvider

java.lang.Object
   ↳ com.google.android.material.transition.platform.ScaleProvider


A class that configures and is able to provide an Animator that scales a view.

ScaleProvider's constructor optionally takes a growing parameter. By default, this is set to true and will increase the size of the target both when appearing and disappearing. This is useful when pairing two animating targets, one appearing and one disappearing, that should both be either growing or shrinking to create a visual relationship.

Summary

Public constructors

ScaleProvider()
ScaleProvider(boolean growing)

Public methods

Animator createAppear(ViewGroup sceneRoot, View view)

Should return an Animator that animates in the appearing target view.

Animator createDisappear(ViewGroup sceneRoot, View view)

Should return an Animator that animates out the disappearing target view.

float getIncomingEndScale()

The scale x and scale y value which an appearing and growing target will scale to and a disappearing and shrinking target will scale from.

float getIncomingStartScale()

The scale x and scale y value which an appearing and growing target will scale from and a disappearing and shrinking target will scale to.

float getOutgoingEndScale()

The scale x and scale y value which an appearing and shrinking target will scale from and a disappearing and growing target will scale to.

float getOutgoingStartScale()

The scale x and scale y value which an appearing and shrinking target will scale to and a disappearing and growing target will scale from.

boolean isGrowing()

Whether or not this animation's target will grow or shrink in size.

boolean isScaleOnDisappear()

Whether or not a scale animation will be run on this animation's target when disappearing.

void setGrowing(boolean growing)

Set whether or not this animation's target will grow or shrink in size.

void setIncomingEndScale(float incomingEndScale)

Set the scale x and scale y value which an appearing and growing target should scale to and a disappearing and shrinking target should scale from.

void setIncomingStartScale(float incomingStartScale)

Set the scale x and scale y value which an appearing and growing target should scale from and a disappearing and shrinking target should scale to.

void setOutgoingEndScale(float outgoingEndScale)

Set the scale x and scale y value which an appearing and shrinking target should scale from and a disappearing and growing target should scale to.

void setOutgoingStartScale(float outgoingStartScale)

Set the scale x and scale y value which an appearing and shrinking target should scale to and a disappearing and growing target should scale from.

void setScaleOnDisappear(boolean scaleOnDisappear)

Set whether or not a scale animation will be run on this animation's target when disappearing.

Inherited methods

From class java.lang.Object
From interface com.google.android.material.transition.platform.VisibilityAnimatorProvider

Public constructors

ScaleProvider

ScaleProvider ()

ScaleProvider

ScaleProvider (boolean growing)

Parameters
growing boolean

Public methods

createAppear

Animator createAppear (ViewGroup sceneRoot, 
                View view)

Should return an Animator that animates in the appearing target view.

Parameters
sceneRoot ViewGroup: The root of the transition hierarchy, which can be useful for checking configurations such as RTL

view View: The view that is appearing

Returns
Animator

createDisappear

Animator createDisappear (ViewGroup sceneRoot, 
                View view)

Should return an Animator that animates out the disappearing target view.

Parameters
sceneRoot ViewGroup: The root of the transition hierarchy, which can be useful for checking configurations such as RTL

view View: The view that is disappearing

Returns
Animator

getIncomingEndScale

float getIncomingEndScale ()

The scale x and scale y value which an appearing and growing target will scale to and a disappearing and shrinking target will scale from.

Returns
float

getIncomingStartScale

float getIncomingStartScale ()

The scale x and scale y value which an appearing and growing target will scale from and a disappearing and shrinking target will scale to.

Returns
float

getOutgoingEndScale

float getOutgoingEndScale ()

The scale x and scale y value which an appearing and shrinking target will scale from and a disappearing and growing target will scale to.

Returns
float

getOutgoingStartScale

float getOutgoingStartScale ()

The scale x and scale y value which an appearing and shrinking target will scale to and a disappearing and growing target will scale from.

Returns
float

isGrowing

boolean isGrowing ()

Whether or not this animation's target will grow or shrink in size.

Returns
boolean

isScaleOnDisappear

boolean isScaleOnDisappear ()

Whether or not a scale animation will be run on this animation's target when disappearing.

Returns
boolean

setGrowing

void setGrowing (boolean growing)

Set whether or not this animation's target will grow or shrink in size.

Parameters
growing boolean

setIncomingEndScale

void setIncomingEndScale (float incomingEndScale)

Set the scale x and scale y value which an appearing and growing target should scale to and a disappearing and shrinking target should scale from.

Parameters
incomingEndScale float

setIncomingStartScale

void setIncomingStartScale (float incomingStartScale)

Set the scale x and scale y value which an appearing and growing target should scale from and a disappearing and shrinking target should scale to.

Parameters
incomingStartScale float

setOutgoingEndScale

void setOutgoingEndScale (float outgoingEndScale)

Set the scale x and scale y value which an appearing and shrinking target should scale from and a disappearing and growing target should scale to.

Parameters
outgoingEndScale float

setOutgoingStartScale

void setOutgoingStartScale (float outgoingStartScale)

Set the scale x and scale y value which an appearing and shrinking target should scale to and a disappearing and growing target should scale from.

Parameters
outgoingStartScale float

setScaleOnDisappear

void setScaleOnDisappear (boolean scaleOnDisappear)

Set whether or not a scale animation will be run on this animation's target when disappearing.

This is useful when using a single ScaleProvider that runs on multiple targets and only appearing targets should be animated.

Parameters
scaleOnDisappear boolean