java - View 的动画集

标签 java android android-animation viewpropertyanimator

我知道可以使用这样的动画集同时运行一系列动画:

AnimationSet animationSet = new AnimationSet(true);
                                animationSet.addAnimation(new RotateAnimation(this,0));
                                /**
                                 * more animation
                                 */
                                animationSet.addAnimation(new RotateAnimation(this,90));
                                animationSet.start();

我想用 viewanimator 实现类似的效果(同时显示一系列 View 的动画):

ViewPropertyAnimator a = v.animate().rotation(0).setDuration(500);

有什么办法可以实现这个目标吗?

最佳答案

If only one or two properties on a View object are being animated, then using an ObjectAnimator is fine.But if several properties are animated simultaneously, or if you just want a more convenient syntax to animate a specific property, then ViewPropertyAnimator might be more well-suited to the task.

    view.animate().scaleX(2).scaleY(4).rotation(180).
    setDuration(3000).setInterpolator(new 
    AccelerateDecelerateInterpolator()).start();

关于java - View 的动画集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48636904/

相关文章:

java - PDFBox 嵌入的 TTF 字体不起作用

java - 限制java8并行流的CPU使用率/Java 8并行流的高CPU使用率

android - 异步任务的 Gridview 回收问题

android - 如何在Android中使用xml中的object animator做旋转动画时设置一个轴心点?

android - 有什么方法可以让 Animation-List xml set drawable 突然变成 BitmapDrawable?

java - ArrayList 的初始大小

java - 关于ConcurrentHashMap,下面是什么意思?

android - 如何使 ViewPager2 不那么敏感?

java - 添加 admob jar 文件和类未找到错误

在设备上动画 View 时 Android WebView 闪烁错误