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

Colton Idle

06/05/2023, 9:00 PM
Anyone have a autosizeText impl they like? I copied a few from SO, but using them in an AnimatedVisibility block causes weirdness (text grows every frame lol). Anyone have some impl they could share?
f

Francesc

06/05/2023, 9:12 PM
I don't, but depending on your layout, maybe you can try to replace the default animation (fade + expand) to simply fade so that the size does not change
v

Valentin Gusselnikov

06/05/2023, 10:28 PM
Did you try wrapping
AppCompatTextView
with
AndroidView
and manually enabling autosize for it with
TextViewCompat.setAutoSizeText...
?
a

Albert Chang

06/06/2023, 2:54 AM
My implementation (auto shrink only though) However text resizing during expand/shrink animation seems expected, as its layout size will be changing.
c

Colton Idle

06/06/2023, 4:35 PM
Good points about fade + expand vs animatedVisibility. I'll try that with alberts impl.
2 Views