Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get text bounds of space

Tags:

android

How to measure bounds of space in android?

I mean, the following:

Rect bounds = new Rect();    
paint.getTextBounds(String.valueOf(' '), 0, 1, bounds);
return bounds.width();

returns 0.

like image 900
user1256821 Avatar asked Oct 31 '12 12:10

user1256821


1 Answers

The solution is to use paint.measureText(String.valueOf(' ')) instead.

like image 120
user1256821 Avatar answered Nov 03 '22 11:11

user1256821