android - 在 View 上变换和缩放动画

标签 android scale translate-animation

我有一个线性布局,其中包含三个图像。单击任何 ImageView 我想为整个线性布局设置动画。该动画由两个动画组成 - 缩放和变换。我不知道如何执行此动画。

这就是我想要的-

图 1 - 动画前

Image1

图 2 - 动画后

Image2

我不仅想为 View 设置动画,而且还想通过动画将 View 实际移动到新位置。动画完成后,我应该可以在新位置而不是旧位置单击图像。

我该如何执行此操作?请帮帮我。

最佳答案

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

翻译:

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

yValue 是我要平移到的 y 轴上的值。

缩放:

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

关于android - 在 View 上变换和缩放动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22423753/

相关文章:

css - css 中的值可以四舍五入吗?或者,如何解决%翻译布局上的半/子像素问题?

android - ImageView 上的 TranslateAnimation (Android)

android - 如何使用 ConstraintLayout 在 Android 中针对不同的屏幕尺寸缩放 UI 元素

android - Intent Extras 的通用对值类型

android - 如何在 Google Play 中为每个国家分配不同的应用名称

android - 尽管 ellipsize=end,但带有长文本的 Textview 会在 GridLayout 中推出其他 View

webkit - 使用 -webkit-transform : scale(. 时不需要的左边距 ..)

qt - QBrush - 缩放标准填充点画图案?

android - 将 TextView 从右向左翻译

android - EditText 中的动态自动大写、自动更正或密码字段