draw text as big as possible inside a rectangle

by Michael Bollmann » Sat, 11 Apr 2009 21:42:08 GMT


Sponsored Links
 Is there any convenient method to draw a string (custom true type
font)
as big is possible inside a supplied rectangle or to calculate the
font
size of a paint object based on a string and some rectangle
dimensions.

Thanks in advance
Michael
--~--~---------~--~----~------------~-------~--~----~



draw text as big as possible inside a rectangle

by Michael Bollmann » Tue, 14 Apr 2009 00:08:17 GMT


 thanks for your reply

in case anyone runs into the same problem i solved it using
getTextBounds

1. calculate the scale factor between your original rect and the rect
returned by getTextBounds
2. multiply the font size by this factor
--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. Audio Settings Permission Denial

I am attempting to enable/disable bluetooth support in my app, like
this:

        AudioManager am = (AudioManager) getSystemService
(Context.AUDIO_SERVICE);
        am.setBluetoothA2dpOn(bluetooth);

----

And when I make that call, I get:

09-25 22:42:20.290: WARN/AudioService(586): Audio Settings Permission
Denial: setRouting() from pid=847, uid=10019

----

In my AndroidManifest.xml file I have this:

        <uses-permission android:name="android.permission.BLUETOOTH"></uses-
permission>
        <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"></
uses-permission>

any ideas?

tia.
--~--~---------~--~----~------------~-------~--~----~

2. Move widget programatically

Hello all,

Is it possible to programatically move a widget through the home
screen?

Thanks.
--~--~---------~--~----~------------~-------~--~----~

3. display brightness settings from my activity

4. Gimana cara nge-Root, dan Gunanya handset di ROOT apa?

5. How to run GPS based application (WikiTude) in Android SDK Emulator?

6. Freezing and thawing of Views in a Gallery

7. ProgressDialog doesnt show when called...?