ViewAnimator icon indicating copy to clipboard operation
ViewAnimator copied to clipboard

Starting animation from visibility GONE

Open royhenengel opened this issue 7 years ago • 2 comments

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

royhenengel avatar Jul 05 '17 05:07 royhenengel

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)

ghost avatar Jul 23 '17 03:07 ghost

yes ;)

florent37 avatar Sep 19 '17 06:09 florent37