Animate visibility of a view from gone to visible with animation

前端 未结 5 823
傲寒
傲寒 2021-02-01 17:53

I have a view that is invisible by default(Just for the first time).

Now I need to switch the visibility to VISIBLE with this animation

5条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-01 18:33

    Add animations using ConstraintLayout

    Just add below code above the views whose visibility is updated:

    TransitionManager.beginDelayedTransition(constraintLayout)
    

    Note:

    • ConstraintLayout will only perform animation on its direct children since it only knows when you change layout parameters and constraints on the children that it handles.
    • ConstraintLayout only animates layout related changes.

    For more see this post https://robinhood.engineering/beautiful-animations-using-android-constraintlayout-eee5b72ecae3

提交回复
热议问题