Hi !

I need to center a certain text on an image that can have a variable
size. I arranged it to center the text horizontally by using this
code:

   float textXPos = (size-paintText.getTextWidths(value, new
float[1]) ) / 2;

Where size is the size of the canvas. (It's a square btw)

But now I don't know how to position the text because I don't know how
to find the pixel size of the text. I know how to get the Text size
but that float only represents a pt number or sth.
This is the rest of the code:

            Paint paintText = new Paint();
            paintText.setAntiAlias(true);
            paintText.setTextSize(textSize);
            paintText.setTextAlign(Paint.Align.CENTER);
            canvas.drawText(value, textXPos, textYPos, paintText);

Hope you know hoe to help me :)
greets
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to