Basically, what I would like to do is a given text (String) with a given width and font mesaure the height of the text. Then I would use the resulting height to create a TextView with the specified height and width. I tried to measure the height of the text using methods from the Paint class, but they give me approximate results. What would be the best way to achieve this?
On iPhone sdk, this can easily be done using the NSString:sizeWithFont:forWidth:lineBreakMode . Is there something similar in Android sdk?
source share