I am trying to create a simple TextField
in Jetpack Compose with a leading icon and a placeholder string Search...
.
But when I give the TextField
a custom height of 48.dp
, the placeholder text gets slightly cut-off from the bottom:
Here’s my code:
TextField(
modifier = modifier
.fillMaxWidth()
.height(48.dp),
value = value,
onValueChange = { value = it },
placeholder = {
Text(
text = "Search...",
textAlign = TextAlign.Center,
fontSize = 12.sp,
)
},
shape = CircleShape,
leadingIcon = {
Icon(
painter = painterResource(id = R.drawable.search_24px),
contentDescription = "Search"
)
},
colors = TextFieldDefaults.colors(
unfocusedIndicatorColor = Color.Transparent,
focusedIndicatorColor = Color.Transparent
)
)
Please help!