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

Vsevolod Kaganovych

08/18/2021, 6:34 PM
Hi. I have a
TextField
with label. I want to change the
fontSize
of label but leave the behaviour that it becomes smaller when it floats to the top. If I change font size, the animation of decreasing size is gone and label has the same size in focused and unfocused mode. But if I don't set manually
fontSize
, everything works as expected. Any suggestions? Code in thread.
Copy code
TextField(
                value = emailText,
                onValueChange = onEmailChange,
                label = {
                    Text(
                        text = stringResource(id = R.string.email),
                        color = colorResource(id = R.color.login_text_color),
                        fontSize = 32.sp
                    )
                }
            )
a

Anastasia Rozovskaya

08/19/2021, 8:45 AM
may be your should manually animate the fontSize now by using
.animateFloatAsState
(I do not see .animate*Sp*AsState yet, so that’s why the Float)
2 Views