Is it possible to set the size of TextView in characters?

I want to display a ListView whose elements are LinearLayout's with several embedded objects, the first of which is a textView with a string, the maximum length of which does not exceed 12 characters. Is it possible to align the lengths of listview with different rows in size which is a maximum string length?

October 3rd 19 at 02:00
2 answers
October 3rd 19 at 02:02
Solution

Yes, you can have the TextView has a property "ems", sootvetsvtvenno, you can specify minEms="12" and maxEms="12" and the width of the TextView is equal to 12 characters regardless of the number of symbols in it

October 3rd 19 at 02:04

No. The main reason: the size of the characters depends on the font size. And all other dimensions are calculated using conventional mathematics.

PS: wrote Nonsense. Artem_zin rights. Here opisalovo.

I was trying to get with Paint paint = new Paint(); maxWidth = paint.measureText("LONG WHITE SPACE FOR the BARCODE"); but somehow the width was insufficient. Thanks for the link. - princ commented on October 3rd 19 at 02:07

Find more questions by tags Android