在代码中,图像边框仅在侧面,而不是在角落。对于按钮,背景超出形状/边框。我只能通过使用固定高度来“修复”按钮,但我不明白为什么固定高度有帮助,我想知道是否有另一种方法可以做到这一点。
@Composable
fun Test(){
Column(modifier = Modifier.padding(5.dp)) {
Image(
painter = painterResource(id = R.drawable.ic_close),
contentDescription = null,
modifier = Modifier
.clip(CircleShape)
.border(1.dp, Color.Red)
.size(20.dp)
)
OutlinedButton(
onClick = { },
border = BorderStroke(1.dp, Color.Red),
shape = RoundedCornerShape(5.dp),
modifier = Modifier
.clip(RoundedCornerShape(5.dp))
.fillMaxWidth()
.background(Color.Green)
) {}
}
}
Run Code Online (Sandbox Code Playgroud) android android-jetpack-compose android-jetpack-compose-button