vr_*_*han 6 android scaffold android-jetpack-compose
我写这段代码。
Image (
painter = painterResource(id = R.drawable.image),
contentDescription = "fab",
modifier = Modifier
.size(80.dp)
.clickable(
interactionSource = remember { MutableInteractionSource() },
indication = rememberRipple(true),
onClick = { /* TODO */ }
)
)
Run Code Online (Sandbox Code Playgroud)
但是,我使用脚手架。所以我想使用浮动操作按钮或扩展浮动操作按钮。如何使用浮动操作按钮和自定义图像。我有一张圆形照片用于按钮。
Scaffold(
topBar = {},
content = {},
floatingActionButton = {
Image {
/* How can I wrire */
}
}
)
Run Code Online (Sandbox Code Playgroud)
你可以使用类似的东西:
Scaffold(
topBar = {},
content = {},
floatingActionButton = {
FloatingActionButton(onClick = { /*TODO*/ }) {
Image (
painter = painterResource(id = R.drawable.xxxx),
contentDescription = "fab",
contentScale = ContentScale.FillBounds
)
}
}
)
Run Code Online (Sandbox Code Playgroud)