For your view in Java you can do something like this -
Animation fadeIn = new AlphaAnimation(0, 1);
fadeIn.setInterpolator(new DecelerateInterpolator()); //add this
fadeIn.setDuration(1000);
Animation fadeOut = new AlphaAnimation(1, 0);
fadeOut.setInterpolator(new AccelerateInterpolator()); //and this
fadeOut.setStartOffset(1000);
fadeOut.setDuration(1000);
AnimationSet animation = new AnimationSet(false); //change to false
animation.addAnimation(fadeIn);
animation.addAnimation(fadeOut);
View.startAnimation(animation);
If you want to use only one if you wish to.
You can even stop it by calling clearing it
View.clearAnimation();
OR other way
For XML, in your res/anim
folder make a file, suppose name is fadein.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator">
<alpha
android:fromAlpha="0.1"
android:toAlpha="1.0"
android:duration="2000"
/>
</set>
And in java
Animation animationFadeIn = AnimationU
tils.loadAnimation(this, R.anim.fadein);
View.startAnimation(animationFadeOut);
Use startAnimation()
in a method where navigation becomes visible