Jetpack Compose中EditText的supportingText超出父容器并存在左侧内边距问题求助
Jetpack Compose中EditText的supportingText超出父容器并存在左侧内边距问题求助
大家好,最近在做Jetpack Compose项目时遇到了一个关于输入组件supportingText的问题,折腾半天没搞明白,来请教下各位大佬~
我在Composable函数里使用输入组件(类似EditText的Material3组件),设置supportingText的代码如下:
supportingText = ui.emailError?.let { { Text( text = it, color = MaterialTheme.colorScheme.error ) } },
但实际运行后的结果和预期不符,通过Layout Inspector观察到两个奇怪的现象:
- 这个supportingText对应的Text组件左侧有额外的内边距,并不是我手动设置的
- Text的内容直接超出了父容器的范围,没有自动换行或者适配父容器宽度
我当前使用的是Jetpack Compose Material3 1.1.2版本,依赖配置如下:
compose-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "compose-material3" }
有没有大佬知道这是什么原因导致的?或者有什么解决办法吗?
备注:内容来源于stack exchange,提问作者Luca Nicoletti
相关产品推荐
相关产品推荐

