Hello! How to specify width of TextField in charac...
# compose
p
Hello! How to specify width of TextField in character count?
o
Characters have different width in non-monospaced font. What are you trying to achieve?
p
Hello, Ilya! I want to calculate expected size in character count with account of font, spaces between chars, etc. In case of non monospaced characters it is ok to take largest char width. Now i'm doing it by just specifying constant value in dp, which is not good, cause font and other things may change.
o
You can measure a template string like
WWWW
and use it as an estimate. I’m on mobile and can’t lookup sample code, but I remember something like “paragraph intrinstics” for text measurements.
p
Thanks, Ilya! I'll dig in this way.
z
p
Thanks, Zach!