Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Starting animation from visibility GONE #34

Open
royhenengel opened this issue Jul 5, 2017 · 2 comments
Open

Starting animation from visibility GONE #34

royhenengel opened this issue Jul 5, 2017 · 2 comments

Comments

@royhenengel
Copy link

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

@ghost
Copy link

ghost commented Jul 23, 2017

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)

@florent37
Copy link
Owner

yes ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants