You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android 13中Object Animator移动ViewGroup出现裁剪问题

Android 13上ViewGroup沿Y轴平移动画被裁剪问题

我通过Object Animator实现一个ViewGroup沿Y轴向上平移的动画,在Android 13设备上运行时,该ViewGroup向上移动过程中会被裁剪,而Android 10设备上运行完全正常。

设备运行效果

  • Android 13设备:Android 13上的表现
  • Android 10设备:Android 10上的表现

动画实现代码

val totalAnimationDuration = 2000L

val context = cameraUIBinding!!.stepsLayout.context

val moveOutAnimator = ObjectAnimator.ofFloat(
    cameraUIBinding!!.stepsLayout,
    "translationY",
    -context.dpToPx(200f)
)
    .apply {
        duration = totalAnimationDuration
        interpolator = LinearInterpolator()
        repeatCount = 5
    }

moveOutAnimator.start()

Android Studio布局截图

Android Studio布局

内容的提问来源于stack exchange,提问作者Chinmay

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.03 15:44:56