我写这段代码。
Image (
painter = painterResource(id = R.drawable.image),
contentDescription = "fab",
modifier = Modifier
.size(80.dp)
.clickable(
interactionSource = remember { MutableInteractionSource() },
indication = rememberRipple(true),
onClick = { /* TODO */ }
)
)
但是,我使用脚手架。 所以我想使用 float 操作按钮或扩展 float 操作按钮。 如何使用 float 操作按钮和自定义图像。 我有一张圆形照片用于按钮。
Scaffold(
topBar = {},
content = {},
floatingActionButton = {
Image {
/* How can I wrire */
}
}
)
最佳答案
你可以使用类似的东西:
Scaffold(
topBar = {},
content = {},
floatingActionButton = {
FloatingActionButton(onClick = { /*TODO*/ }) {
Image (
painter = painterResource(id = R.drawable.xxxx),
contentDescription = "fab",
contentScale = ContentScale.FillBounds
)
}
}
)
关于Android Jetpack Compose - 自定义图像的 float 操作按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70909849/