如何移除Jetpack Compose中文本的字体内边距?
如何移除Jetpack Compose中文本的字体内边距?
我正尝试移除Jetpack Compose中文本顶部和底部的字体内边距,试过官方分享的解决方案但没有效果。
问题截图如下:
左侧(蓝色)是用Image组件渲染的图片,无内边距;右侧(灰色)是显示汉字“木”的Text组件,字符上下存在明显的字体内边距。
我使用的代码如下:
characters?.let { Text( text = it, style = MaterialTheme.typography.labelLarge.copy( color = color, fontFamily = notoSansJPFamily, fontSize = 72.sp, fontWeight = FontWeight.Normal, lineHeight = 72.sp, lineHeightStyle = LineHeightStyle( alignment = LineHeightStyle.Alignment.Center, trim = LineHeightStyle.Trim.Both ), platformStyle = PlatformTextStyle( includeFontPadding = false ), ) ) } ?: CharacterIcon( resourceName = slug.resourceName(id), color = MaterialTheme.colorScheme.inverseSurface, fontSize = 72.sp, )
CharacterIcon是自定义组件,当characters为null时会渲染图片(Image)。
请问该如何彻底移除这个字体内边距?
内容的提问来源于stack exchange,提问作者codejockie
相关产品推荐
相关产品推荐

