误报“此动画应以 #start() 开始”棉绒警告

发布于 2025-01-18 12:24:10 字数 605 浏览 4 评论 0原文

“缺少 recycle() 调用”

在将 Android Studio 更新到 Bumblebee 2021.1.1 Patch 2 后,我收到了有关之前实现的动画(准确地说是在 ofInt() 上)的 lint 警告从4.2.1开始。

有趣的是,当我像这样使用它时,我收到警告:

ObjectAnimator.ofInt(progressBar, "progress", 50).apply {
    startDelay = 300L
    duration = 1500L
    start()
}

但是当我将它保存在这样的变量中时,我没有收到警告:

val objectAnimator = ObjectAnimator.ofInt(progressBar, "progress", 50).apply {
    startDelay = 300L
    duration = 1500L
    start()
}

知道为什么会发生这种情况吗?
有什么想法如何解决/防止警告而不将此操作不必要地保存在变量中吗?

"Missing recycle() calls"

I got a lint warning on previously implemented animations (on ofInt() to be precise) after updating Android Studio to Bumblebee 2021.1.1 Patch 2 from 4.2.1.

What's interesting, is that when I use it like this, I get the warning:

ObjectAnimator.ofInt(progressBar, "progress", 50).apply {
    startDelay = 300L
    duration = 1500L
    start()
}

But when I save it in a variable like this, I get no warning:

val objectAnimator = ObjectAnimator.ofInt(progressBar, "progress", 50).apply {
    startDelay = 300L
    duration = 1500L
    start()
}

Any ideas why it's happening?
Any ideas how to resolve/prevent the warning without saving this operation in a variable unnecessarily?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文