百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
V

ViewAnimator

> 编程语言
开源

一套流畅的 Android 动画库

2.7K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

一套流畅的 Android 动画库

ViewAnimator

一个流畅的Android动画库!

# 使用方法

从一个方法中动画化多个视图

java
ViewAnimator
       .animate(image)
            .translationY(-1000, 0)
            .alpha(0,1)
       .andAnimate(text)
            .dp().translationX(-20, 0)
            .decelerate()
            .duration(2000)
       .thenAnimate(image)
            .scale(1f, 0.5f, 1f)
            .accelerate()
            .duration(1000)
       .start();
       

不使用ViewAnimator

…

更多

在多个视图上添加相同的动画

java
ViewAnimator
       .animate(image,text)
       .scale(0,1)
       .start();

添加监听器

java
ViewAnimator
       .animate(image)
       .scale(0,1)
       .onStart(() -> {})
       .onStop(() -> {})
       .start();

使用DP值

java
ViewAnimator
       .animate(image)
       .dp().translationY(-200, 0)
       .start();

动画化高度/宽度

java
ViewAnimator
       .animate(view)
       .waitForHeight() //wait until a ViewTreeObserver notification
       .dp().width(100,200)
       .dp().height(50,100)
       .start();

颜色动画

java
ViewAnimator
       .animate(view)
       .textColor(Color.BLACK,Color.GREEN)
       .backgroundColor(Color.WHITE,Color.BLACK)
       .start();

旋转动画

java
ViewAnimator
       .animate(view)
       .rotation(360)
       .start();

自定义动画

java
ViewAnimator
       .animate(text)
       .custom(new AnimationListener.Update<TextView>() {
            @Override public void update(TextView view, float value) {
                  view.setText(String.format("%.02f",value));
            }
        }, 0, 1)
       .start();

取消动画

java
ViewAnimator viewAnimator = ViewAnimator
       .animate(view)
       .rotation(360)
       .start();

viewAnimator.cancel();

增强动画(感谢 AndroidViewAnimations 和 NiftyDialogEffects )

java
.shake().interpolator(new LinearInterpolator());
.bounceIn().interpolator(new BounceInterpolator());
.flash(

<a href="https://goo.gl/WXW8Dc">

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Javaandroidanimanimationcompat

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言