How to make text fade in and out in Android?

后端 未结 6 615
说谎
说谎 2021-01-30 12:44

I have a paragraph of text and when a button is clicked I want that text to fade out, change to some other text, then fade back in. I have some code but it doesn\'t do the fade

6条回答
  •  我在风中等你
    2021-01-30 13:19

    If you want to use Animation, you can use an AnimatorListener to listen for when the first animation is done, and then start the second animation. That would be onAnimationEnd().

    More information available here: http://developer.android.com/reference/android/animation/Animator.AnimatorListener.html

    There might be a better way to do it with AnimationSet, but this works for sure.

提交回复
热议问题