在我的 TextField 中,默认情况下标签和下划线之间有很多差距。
这是它的样子:
如何缩小差距?
这是我的最顶层 TextField 的代码:
val query = remember { mutableStateOf("") }
TextField(
value = query.value,
onValueChange = { newValue -> query.value = newValue },
label = {
Text(
"Name as on PAN Card",
color = colorResource(id = R.color.bright_green),
fontSize = with(LocalDensity.current) {
dimensionResource(id = R.dimen._9ssp).toSp()
})
},
textStyle = TextStyle(
textAlign = TextAlign.Start,
color = colorResource(id = R.color.bright_green),
fontFamily = FontFamily(Font(R.font.poppins_regular)),
fontSize = with(LocalDensity.current) {
dimensionResource(id = R.dimen._16ssp).toSp()
},
),
modifier = Modifier
.constrainAs(name) {
top.linkTo(glName)
start.linkTo(parent.start)
end.linkTo(parent.end)
},
colors = TextFieldDefaults.textFieldColors(
backgroundColor = Color.Transparent,
unfocusedIndicatorColor = colorResource(id = R.color.bright_green),
focusedIndicatorColor = colorResource(id = R.color.bright_green)
)
)