سؤال

I have a linear layout with three images in it. On the click of any ImageView I want to animate the whole linear layout. The animation consists of two animations - scale and transform. I don't know how to perform this animation.

This is what I want -

Image 1 - Before Animation

Image1

Image 2 - After Animation

Image2

I want to not only animate the View but actually shift the view to its new location with animation. After animation I should be able to click the Images at their new locatoin not the old location.

How can I perform this? Please help me out.

هل كانت مفيدة؟

المحلول

I used nineoldandroids library to achieve this animation. I used two animation: translation and scaling.

Translation:

ObjectAnimator.ofFloat(frameCategoryScroll, "translationY", 0, -yValue).setDuration(600).start();

yValue is the the value in y axis upto which I want to translate.

Scaling:

ObjectAnimator.ofFloat(frameCategoryScroll, "scaleX", 1.0f, 0.6f).setDuration(600).start();
ObjectAnimator.ofFloat(frameCategoryScroll, "scaleY", 1.0f, 0.6f).setDuration(600).start();
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top