Android 12 Developer Preview is here! Try it out, and give us your feedback!

FadeProvider

public final class FadeProvider
extends Object implements VisibilityAnimatorProvider

java.lang.Object
   ↳ com.google.android.material.transition.FadeProvider


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

Summary

Public constructors

FadeProvider()

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 getIncomingEndThreshold()

Get the fraction at which the appearing fade animation will end between 0 and 1.

void setIncomingEndThreshold(float incomingEndThreshold)

Set the fraction by which an appearing fade animation should end between 0 and 1.

Inherited methods

Public constructors

FadeProvider

public FadeProvider ()

Public methods

createAppear

public 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

public 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

getIncomingEndThreshold

public float getIncomingEndThreshold ()

Get the fraction at which the appearing fade animation will end between 0 and 1.

Returns
float

setIncomingEndThreshold

public void setIncomingEndThreshold (float incomingEndThreshold)

Set the fraction by which an appearing fade animation should end between 0 and 1.

This can be used to stagger animations when this class' resulting animator is used inside an AnimatorSet. If the containing AnimatorSet has a total duration of 100 milliseconds and incomingEndThreshold is set to .75f, this class' animator will run and complete (the view will be completely faded in) after the AnimatorSet has run for 75 milliseconds.

Parameters
incomingEndThreshold float