How to make text fade in and out in Android?

后端 未结 6 608
说谎
说谎 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:27

    There is a better way to make the same effect.

    You should configure the animation to repeat in the inverse mode.

    Here is an example:

        final Animation out = new AlphaAnimation(1.0f, 0.0f);
        out.setRepeatCount(Animation.INFINITE);
        out.setRepeatMode(Animation.REVERSE);
        out.setDuration(3000);
        mSwitcher.startAnimation(out);
    

提交回复
热议问题