Joey
12/13/2024, 1:55 PMJoey
12/13/2024, 1:55 PMkotlin
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
MaterialTheme {
Column(Modifier.safeDrawingPadding()) {
var input by rememberSaveable(stateSaver = TextFieldValue.Saver) {
mutableStateOf(TextFieldValue(""))
}
val focusRequester = LocalFocusManager.current
Button({
focusRequester.clearFocus()
}) { Text("Unfocus") }
TextField(
onValueChange = { input = it },
value = input,
label = { Text("Label") },
placeholder = { Text("Placeholder") },
modifier = Modifier.fillMaxWidth(),
)
}
}
}
}
}
Doesn't seem to matter if you have a placeholder or not, just having a label and text does the same visual glitch
Also tried different compose versions and also still happens in the latest (2024.12.01)gmz
12/13/2024, 2:58 PMval verticalPadding = 16
val lineHeight = LocalTextStyle.current.lineHeight.value
val height = with(LocalDensity.current) {
(verticalPadding * 2 + lineHeight * fontScale).dp
}
gmz
12/13/2024, 3:01 PMTextFieldPadding
, which is an internal constantJoey
12/13/2024, 3:18 PMgmz
12/13/2024, 3:22 PM