fadeout.xml
<alpha
android:duration="4000"
android:fromAlpha="1.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:toAlpha="0.0" />
fadein.xml
<alpha
android:duration="6000"
android:fromAlpha="0.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:toAlpha="1.0" />
In your java class
Animation animFadeOut = AnimationUtils.loadAnimation(this, R.anim.fade_out);
Animation animFadeIn = AnimationUtils.loadAnimation(this, R.anim.fade_in);
animFadeOut.reset();
imageview.clearAnimation();
imageview.startAnimation(animFadeOut);
animFadeIn.reset();
imageview.clearAnimation();
imageview.startAnimation(animFadeIn);
and hide or view the image where you want
check this also link
You need to create a new folder by right-clicking on the res folder, create a new folder name for it anim. And you can place xmls animation in it.
,