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


abstract class Visibility : Transition
   ↳ androidx.transition.Transition
   ↳ androidx.transition.Visibility

This transition tracks changes to the visibility of target views in the start and end scenes. Visibility is determined not just by the View#setVisibility(int) state of views, but also whether views exist in the current view hierarchy. The class is intended to be a utility for subclasses such as Fade, which use this visibility information to determine the specific animations to run when visibility changes occur. Subclasses should implement one or both of the methods onAppear(ViewGroup, TransitionValues, int, TransitionValues, int), onDisappear(ViewGroup, TransitionValues, int, TransitionValues, int) or onAppear(ViewGroup, View, TransitionValues, TransitionValues), onDisappear(ViewGroup, View, TransitionValues, TransitionValues).


static Int

Mode used in setMode(int) to make the transition operate on targets that are appearing.

static Int

Mode used in setMode(int) to make the transition operate on targets that are disappearing.

Inherited constants
Public constructors

<init>(@NonNull context: Context, @NonNull attrs: AttributeSet)

Public methods
open Unit
captureEndValues(@NonNull transitionValues: TransitionValues)

open Unit
captureStartValues(@NonNull transitionValues: TransitionValues)

open Animator?
createAnimator(@NonNull sceneRoot: ViewGroup, @Nullable startValues: TransitionValues?, @Nullable endValues: TransitionValues?)

open Int

Returns whether appearing and/or disappearing Views are supported.

open Array<String!>?

open Boolean
isTransitionRequired(@Nullable startValues: TransitionValues?, @Nullable newValues: TransitionValues?)

open Boolean

Returns whether the view is 'visible' according to the given values object.

open Animator?
onAppear(sceneRoot: ViewGroup!, startValues: TransitionValues!, startVisibility: Int, endValues: TransitionValues!, endVisibility: Int)

The default implementation of this method does nothing.

open Animator?
onAppear(sceneRoot: ViewGroup!, view: View!, startValues: TransitionValues!,