【问题标题】:Animation not running smooth (rotation)动画运行不流畅(旋转)
【发布时间】:2019-04-23 01:33:32
【问题描述】:

我用 XML 制作了一个相当简单的动画,并在图像上运行。 动画使图像旋转,但问题是动画不是很流畅。

minSdkVersion 16
targetSdkVersion 28

XML 动画 rotate.xml 代码

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">

<rotate android:fromDegrees="0"
        android:toDegrees="360"
        android:duration="600"
        android:interpolator="@android:anim/cycle_interpolator"/>

在我的 java/kotlin MainActivity 类中

lateinit var rotate: Animation

在我的 Oncreate 函数中

rotate = AnimationUtils.loadAnimation(this, R.anim.rotate)

我如何开始动画

btnFishing.startAnimation(rotate)

当我在手机上运行应用程序并测试动画时,它看起来非常不稳定且不流畅。 我尝试录制动画,但事实证明在录制中动画很流畅嗯..

【问题讨论】:

    标签: java android animation rotation smoothing


    【解决方案1】:

    解决了这个问题,我试图制作动画的图像太大了。我首先使用 500*500px,然后通过将图像大小调整为 100*100px 来修复它

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-22
      相关资源
      最近更新 更多