我正在try 创建一个圆形按钮,里面的一些首字母的文本应该居中.按钮大小应该是34.dp
,文本应该是13.sp
,但我必须增加按钮的大小才能正确显示文本
我认为文本没有显示的原因是因为文本可组合的内部填充.
Button(
modifier = Modifier.size(49.dp),
colors = ButtonDefaults.buttonColors(
containerColor = Color.Black,
contentColor = Color.White),
onClick = {
}) {
Text(text = "JB",
fontSize = 13.sp,
fontWeight = FontWeight.SemiBold,
style = TextStyle(
lineHeightStyle = LineHeightStyle(
alignment = LineHeightStyle.Alignment.Center,
trim = LineHeightStyle.Trim.Both
)
)
)
}