https://kotlinlang.org logo
#compose
Title
# compose
r

Rafs

01/03/2022, 10:34 PM
Does anyone have any idea which
TextField
property is responsible for drawing the thin horizontal line when in unfocused mode? It disappears when the textfield is focused. Right image is focused, left is unfocused
c

Chris Sinco [G]

01/04/2022, 4:33 AM
I believe that has to do more with the IME than Compose
t

Tobias Suchalla

01/04/2022, 6:56 AM
That is the
indicatorColor
. You can alter this color via
Copy code
val colors = TextFieldDefaults.textFieldColors(
    focusedIndicatorColor = <http://Color.xyz|Color.xyz>,
    unfocusedIndicatorColor = <http://Color.xyz|Color.xyz>,
    disabledIndicatorColor = <http://Color.xyz|Color.xyz>,
    errorIndicatorColor = <http://Color.xyz|Color.xyz>
)

TextField(
    value = value,
    onValueChange = { value = it },
    colors = colors
)
The line seemingly disappears because it uses the accent color when focused which is apparently also your background color. See also: https://material.io/components/text-fields#filled-text-field
🔥 1
c

Chris Sinco [G]

01/04/2022, 7:09 AM
Ah yeah that is correct 👆
r

Rafs

01/04/2022, 2:58 PM
Thank you @Tobias Suchalla. that's exactly what i've been looking for