Ely*_*lye 1 android android-jetpack-compose
在https://developer.android.com/jetpack/compose/animation
If you are animating changes to content size:
Use Modifier.contentSize.
Run Code Online (Sandbox Code Playgroud)
但是,我找不到如何访问Modifier.contentSize和使用它。任何指南?
我认为您在谈论animateContentSize函数。
这里我有一个可能有帮助的例子
Column(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp)
// This `Column` animates its size when its content changes.
.animateContentSize()
) {
Row {
Icon(
imageVector = Icons.Default.Info,
contentDescription = null
)
// ...
}
if (expanded) { // If the expanded value is changed then the animateContentSize will be triggered
Spacer(modifier = Modifier.height(8.dp))
Text(
text = stringResource(R.string.lorem_ipsum),
textAlign = TextAlign.Justify
)
}
}
Run Code Online (Sandbox Code Playgroud)
来自 Jetpack Compose动画代码实验室:
| 归档时间: |
|
| 查看次数: |
338 次 |
| 最近记录: |