I'm using jetpack compose, kotlin, on Android Studio Hedgehog 2023.1.1 Patch 2. my app's targetSdk = 34个
附图很好地概括了这个问题. 使用自定义排版设置自定义主题后,该主题的排版对按钮的文本不起作用.
colors of the theme work on buttons normally,只是排版不起作用. fonts work on buttons if i explicitly specify them,但由于主题的原因,它们应该自动工作
我try 了不同的字体,同样的问题. 以下是我对该主题的实现:
在Theme.kt
个文件中
@Composable
fun CutomTheme(
content: @Composable () -> Unit
) {
// irrelevant color-related code
MaterialTheme(
colorScheme = colorScheme,
typography = CustomTypography,
content = content
)
}
CustomTypography
%的清晰度
val CustomTypography = Typography(
bodyLarge = TextStyle(
fontFamily = ReemKufi,
fontWeight = FontWeight.Bold,
fontSize = 16.sp,
lineHeight = 24.sp,
letterSpacing = 0.5.sp
)
)