首页 > 解决方案 > Android 彩票动画滞后

问题描述

我正在为 iOS 和 Android 开发一个应用程序。启动画面有一个 JSON 动画。在 iOS 中,动画效果很好,但在 Android 中,相同的动画运行时有延迟。有人经历过吗?

注意:动画没有任何图像资源。

我收到了一些错误日志,但它们似乎不相关,因为我已经尝试过其他运行没有滞后的动画并且它显示相同的错误。

这些是错误:

W/LOTTIE: Lottie doesn't support layer effects. If you are using them for  fills, strokes, trim paths etc. then try adding them directly as contents  in your shape.
Found: [Radial Shadow]
W/LOTTIE: Animation contains merge paths. Merge paths are only supported on KitKat+ and must be manually enabled by calling enableMergePathsForKitKatAndAbove().

标签: androidandroid-animationlottie

解决方案


正如您的警告消息所述,请尝试设置enableMergePathsForKitKatAndAbove().

例如,在 xml -

<com.airbnb.lottie.LottieAnimationView
    ...
    ...
    ...
    app:lottie_enableMergePathsForKitKatAndAbove="true"/>

或者,在 Java 中 -

lottieAnimationView.enableMergePathsForKitKatAndAbove(true);

推荐阅读