动画预览
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Android Studio 允许您从动画预览中检查动画。如果您在可组合项预览中描述了动画效果,则可以检查每个动画值在给定时间点的确切值,并且可以暂停、循环播放、快进或放慢动画,以便在动画过渡过程中调试动画:

您还可以使用动画预览以图形方式呈现动画曲线,这对于确保正确编排动画值非常有用:

动画预览会自动检测可检查的动画,即带有 Start Animation Preview 图标
的动画。

如果您有多个动画,可以使用“动画预览”一次性检查和协调所有这些动画。您还可以冻结特定动画。

使用选择器将非枚举或布尔状态设置为使用精确输入调试 Compose 动画。对于所有受支持的 Compose 动画 API,您都可以播放、暂停、调试、控制速度和进行协调。

动画预览目前支持 updateTransition
、AnimatedVisibility
、animate*AsState
、CrossFade
、rememberInfiniteTransition
和 AnimatedContent
API。如需使用最新功能,请将动画预览与 Android Studio Narwhal Feature Drop 和 compose.animation
1.9.0 及更高版本搭配使用。
为您推荐
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-21。
[null,null,["最后更新时间 (UTC):2025-08-21。"],[],[],null,["# Animation Preview\n\nAndroid Studio allows you to inspect animations from Animation Preview. If an\nanimation is described in a composable preview, you can inspect the exact value\nof each animated value at a given time, pause the animation, loop it,\nfast-forward it, or slow it, to help you debug the animation throughout its\ntransitions:\n\nYou can also use Animation Preview to graph visualize animation curves, which is\nuseful for making sure that the animation values are choreographed properly:\n\nAnimation Preview automatically detects inspectable animations, which are\nindicated by the **Start Animation Preview** icon\n.\n\nIf you have multiple animations, you can use Animation Preview to inspect and\ncoordinate them all at once. You can also freeze a specific animation.\n\nUse pickers to set non-enum or boolean states to debug your Compose animation\nusing precise inputs. For all supported Compose Animation APIs, you can play,\npause, scrub, control speed, and coordinate.\n\nAnimation Preview currently supports the\n[`updateTransition`](/reference/kotlin/androidx/compose/animation/core/package-summary#updateTransition(kotlin.Any,kotlin.String)),\n[`AnimatedVisibility`](/reference/kotlin/androidx/compose/animation/package-summary#AnimatedVisibility(androidx.compose.animation.core.MutableTransitionState,androidx.compose.ui.Modifier,androidx.compose.animation.EnterTransition,androidx.compose.animation.ExitTransition,kotlin.String,kotlin.Function1)),\n[`animate*AsState`](/develop/ui/compose/animation#animate-as-state),\n[`CrossFade`](/develop/ui/compose/animation#crossfade),\n[`rememberInfiniteTransition`](/develop/ui/compose/animation#rememberinfinitetransition),\nand [`AnimatedContent`](/develop/ui/compose/animation#animatedcontent)\nAPIs. To access the latest features, use Animation Preview with\nAndroid Studio Narwhal Feature Drop and `compose.animation` 1.9.0 and higher.\n\nRecommended for you\n-------------------\n\n- Note: link text is displayed when JavaScript is off\n- [Animations in Compose](/develop/ui/compose/animation/introduction)\n- [Animation tooling support {:#tooling}](/develop/ui/compose/animation/tooling)\n- [Value-based animations](/develop/ui/compose/animation/value-based)"]]