在 Compose 中使用主题换肤

作者: sunnyswag创建于 2023年10月7日更新于 2023年10月7日

@Composable private fun ComposeUIImageItem(imgResId: Int, contentDescription: String, imgWidth: Dp = 56.dp, imgHeight: Dp = 90.dp) { AndroidView(factory = { context -> SkinCompatImageView(context).apply { setImageResource(imgResId) setContentDescription(contentDescription) } }, update = { it.setImageResource(imgResId) }, modifier = Modifier.width(imgWidth).height(imgHeight) ) }

内容来源: ximsfei/Android-skin-support