[alpha.xml]

fromAlpah 0.0 -> toAlpha 1.0 투명에서 불투명으로 duration 2000 2초동안 변화시키는 애니메이션임

<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/linear_interpolator"
    android:fromAlpha="0.0"
    android:toAlpha="1.0"
    android:duration="2000"
    android:fillAfter="true">
</alpha>

 

ImageView imageView = findViewById(R.id.splash_imageview);
Animation fadeIn = AnimationUtils.loadAnimation(this, R.anim.alpha);
imageView.startAnimation(fadeIn);

fadeIn.setAnimationListener(new Animation.AnimationListener() {
    @Override
    public void onAnimationStart(Animation animation) {}

    @Override
    public void onAnimationEnd(Animation animation) {
		// 에니메이션이 끝나면 로직 처리
    }

    @Override
    public void onAnimationRepeat(Animation animation) {}
});

+ Recent posts