I want to run animation set: fade out first, and then fade in, but is not working, this is code:
TextView iv_1 = findViewById(R.id.tv_1);
AnimationSet animSet = (AnimationSet) AnimationUtils
.loadAnimation(this, R.anim.fadeout_first); // fadeout_first.xml
iv_1.setAnimation(animSet);
fadeout_first.xml
<set xmlns:android="http://schemas.android.com/apk/res/android">
<!--fade out first-->
<alpha android:duration="2000"
android:fromAlpha="1"
android:toAlpha="0"
/>
<!--and then fade in-->
<alpha android:duration="2000"
android:fromAlpha="0"
android:toAlpha="1"
android:startOffset="2000"/>
</set>
but when I change the order(fade in first, and then fade out), it is working well:
TextView iv_1 = findViewById(R.id.tv_1);
AnimationSet animSet = (AnimationSet) AnimationUtils
.loadAnimation(this, R.anim.fadein_first); // fadein_first.xml
iv_1.setAnimation(animSet);
fadein_first.xml
<set xmlns:android="http://schemas.android.com/apk/res/android">
<!--fade in first-->
<alpha android:duration="2000"
android:fromAlpha="0"
android:toAlpha="1"
/>
<!--and then fade out-->
<alpha android:duration="2000"
android:fromAlpha="1"
android:toAlpha="0"
android:startOffset="2000"/>
</set>
why?