views:

215

answers:

1

Any straight forward way to measure the height of text? The way I am doing it now is by using Paint's measureText() to get the width, then by trial and error finding a value to get an approximate height. I've also been messing around with FontMetrics, but all these seem like approximate methods that suck.

I am trying to scale things for different resolutions. I can do it, but I end up with incredibly verbose code with lots of calculations to determine relative sizes. I hate it! There has to be a better way.

Any way, one thing at a time: Thanks.

A: 

What about [Paint.getTextBounds]1

[1]: http://developer.android.com/reference/android/graphics/Paint.html#getTextBounds(char[], int, int, android.graphics.Rect)

bramp