ViewAnimator
ViewAnimator copied to clipboard
Starting animation from visibility GONE
Hi,
I'm trying to animate a view when it's starting visibility state is View.GONE
.
When setting view visibility on animation start to View.VISIBLE
, the animation results in a very short blink because of the visibility change.
Can you recommend me maybe a better way to animate the view with a starting state of View.GONE
?
Code:
ViewAnimator
.animate(view)
.onStart(new AnimationListener.Start() {
@Override
public void onStart()
{
view.setVisibility(View.VISIBLE);
}
})
.duration(400)
.zoomIn()
.start();
Thank you
You could use the alpha method...
In your case
ViewAnimator
.animate(view)
.alpha(0f, 1f)
// fades in from 0f to 1f
.duration(400)
.zoomIn()
.start();
before you fade in/out, you must've set the initial alpha level to 0f
at the beginning of your code:
view.setAlpha(0f)
yes ;)