Im trying to do a animator kind of like IPhone coverflow but a little more simple. Now im trying to make a rotation and then make the image go fullscreen but nothing is happening.
ImageView i = (ImageView) FindViewById(args.Position);
var disp = WindowManager.DefaultDisplay;
var height = disp.Height;
var width = disp.Width;
ObjectAnimator anim = ObjectAnimator.OfInt(i, "rotationY", 0, 180);
ObjectAnimator scaleX = ObjectAnimator.OfInt(i, "scaleX", width);
ObjectAnimator scaleY = ObjectAnimator.OfInt(i, "scaleY", height);
AnimatorSet set = new AnimatorSet();
set.Play(anim).With(scaleX).With(scaleY);
What is wrong with the code? why is nothing happening?
You need to call Start()
on your AnimatorSet
to actually start the animation.
The Play()
method doesn't actually play the animation- it specifies an animation that the set should play and creates an AnimatorSet.Builder
that you can use for setting up additional constraints (such as your With()
).
Secondly, your ObjectAnimators are all looking for integer properties, but the rotation and scale properties require floats.
You should be using ObjectAnimator.OfFloat()
instead.