变换和规模上的动画视图 [英] Transform and scale animation on a View

查看:155
本文介绍了变换和规模上的动画视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这三张图片的线性布局。在任意的ImageView的点击我想动画整个线性布局。动画由两个动画 - 规模和改造。我不知道如何执行此动画。

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.

这是我想要的 -

图片1 - 动画之前

图片2 - 动画后

我想不仅是动画视图,但实际上视图动画转移到新的位置。动画后,我应该可以点击图片在他们的新locatoin不是原来的位置。

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.

推荐答案

我以前nineoldandroids库来实现这个动画。我用了两个动​​画:平移和缩放

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

翻译:

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

y值是高达,我想在翻译y轴上的值。

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

缩放:

ObjectAnimator.ofFloat(frameCategoryScroll, "scaleX", 1.0f, 0.6f).setDuration(600).start();
ObjectAnimator.ofFloat(frameCategoryScroll, "scaleY", 1.0f, 0.6f).setDuration(600).start();

这篇关于变换和规模上的动画视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆