Is it possible to set singleLine or maxLines on TextField?
I've checked a source and it's missing. Any ideas / workarounds?
You can use the parameter maxLines or singleLine:
TextField(
//..
maxLines = 1)
or
TextField(
//..
singleLine = true)
singleLine is redundant.singleLine is set to true, maxLines will automatically be set to 1. However, neither setting stops the input to accept line breaks (e.g. from an external or keyboard that does not honor the imeAction).singleLine = true forces text to be scrollable. Max lines is not.Since Compose 1.0.0-alpha08, you can use singleLine parameter to make the text field a single horizontally scrollable line:
TextField(
value = text,
onValueChange = { },
singleLine = true
)