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
as big is possible inside a supplied rectangle or to calculate the
size of a paint object based on a string and some rectangle

Thanks in advance

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

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. Permission on apk


I've a problem to read on an apk File.

I've created my sdcard with command 'mksdcard ...'

I execute this code :

        File tmpdir = new File(tmpdirpath+name);
                if (!tmpdir.exists()) {
                        boolean b = tmpdir.mkdirs();
                } else {
                        if (!tmpdir.isDirectory()) {
                                throw new RuntimeException("here : the tmp dir 

with name = name of my apk file.

My file is correctly  created on my temporary directory on /sdcard,
but when i try to read it, i've not the permissions.

My permissions are '- - - - r w - r w -'

I tried to change this permission with

       #adb shell
       # chmod 777

There is no error but my permissions are always the same  '- - - - r w
- r w -'

So in my application, i've the exception :

04-28 14:56:16.296: ERROR/dalvikvm(231): Can't open dex cache '/data/
No such file or directory
04-28 14:56:16.296: INFO/dalvikvm(231): Unable to open or create cache
for /sdcard/.tmpdir/org.python.pycode._pyx0/
04-28 14:56:16.306: WARN/System.err(231): java.io.IOException: unable
to open DEX file
04-28 14:56:16.326: WARN/System.err(231):     at
dalvik.system.DexFile.openDexFile(Native Method)
04-28 14:56:16.336: WARN/System.err(231):     at
04-28 14:56:16.346: WARN/System.err(231):     at
04-28 14:56:16.355: WARN/System.err(231):     at

Some help, please !


2. Custom Locale, Spare parts - how to get them?

Like in the topic - after uprading my G1 Dev Phone with recovery
images provided by HTC I don't have those 2 apps.

3. Call method from Broadcast Receiver

4. how to build the pdk_docs target to generate the document of android

5. Keeping an application transparently on top of all other applications

6. How to change RadioButton size???

7. Anyone working on a Dex decompiler ? I am doing one .