I'd like to change the input font size in TextField of Android Jetpack Compose because it's very small now. Like this
Update:
I don't recall if the parameter was originally present when I originally answered, but there is a fontSize parameter on both the M2 and M3 Text composable that you can set directly and still have it respect the theme (think of it as a one off override)
According to the documentation, there is a parameter textStyle that takes TextStyle that allows you to set font size via fontSize.
You can do the following and it will set the font size to 28 sp
TextField(value = "", onValueChange = {}, textStyle = TextStyle.Default.copy(fontSize = 28.sp))
note: if you want to ensure that your themed style still applies and you're just modifying the size of it, use LocalTextStyle.current.merge(TextStyle(fontSize = 28.sp)) or LocalTextStyle.current.copy(fontSize = 28.sp) instead of TextStyle.Default.copy(fontSize = 28.sp)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With