string width and height

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

string width and height

Postby palak1302 » Tue Mar 04, 2008 3:39 pm

how to get string width and heigth in android?????
palak1302
Junior Developer
Junior Developer
 
Posts: 23
Joined: Thu Jan 31, 2008 5:17 pm

Top

Postby snowtiger » Tue Mar 04, 2008 4:07 pm

snowtiger
Developer
Developer
 
Posts: 34
Joined: Fri Dec 21, 2007 10:44 am

Postby res » Tue Mar 04, 2008 4:20 pm

snowtiger that is for the display area not some text string.

To get string width you can use paint.measureText(string), see http://code.google.com/android/referenc ... ang.String)

For height I use paint.getFontSpacing() although it doesn't give you the exact height of the text just the recommended spacing, http://code.google.com/android/referenc ... ntSpacing()
res
Senior Developer
Senior Developer
 
Posts: 146
Joined: Tue Nov 20, 2007 8:14 pm
Location: United States

Postby palak1302 » Wed Mar 05, 2008 12:55 pm

snowtiger wrote:http://www.anddev.org/viewtopic.php?p=1656


how to use DisplayMetrics class to get string width and height??????/
palak1302
Junior Developer
Junior Developer
 
Posts: 23
Joined: Thu Jan 31, 2008 5:17 pm

Postby plusminus » Wed Mar 05, 2008 1:43 pm

Hello palak1302,

it is DisplayMetrics :!:

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

Return to General

Who is online

Users browsing this forum: No registered users and 4 guests