How to do a fadein of an image on an Android Activity screen?

Hi Hiroshi you can do this for the fade in:

  ImageView myImageView= (ImageView)findViewById(R.id.myImageView);
  Animation myFadeInAnimation = AnimationUtils.loadAnimation(this, R.anim.fadein);
  myImageView.startAnimation(myFadeInAnimation); //Set animation to your ImageView

and inside your res\anim\ folder the animation file fadein.xml

<?xml version="1.0" encoding="UTF-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
        <alpha 
            android:fromAlpha="0.0" 
            android:toAlpha="1.0"
            android:interpolator="@android:anim/accelerate_interpolator"
            android:duration="3000"/>
</set>

but for the gradual fade in from sepia to the full color, you must use TransitionDrawable

Leave a Comment