Thanks a lot. You are right. The x,y for text is lower left.

On Sun, Apr 4, 2010 at 12:14 AM, SoftwareForMe.com SoftwareForMe.com <
[email protected]> wrote:

> I don't recall the exact details in Android, but in almost all graphics
> APIs the Y position for text is either the [baseline] (bottom of a letter
> 'o' or 'n') or [baseline + descent] (bottom of the letter 'g' or 'y').  In
> other words, (x,y) for bitmaps is top-left, (x,y) for text is lower left.
>
> A quick experiment would tell you whether it's the baseline or baseline +
> descent.
>
> On Sat, Apr 3, 2010 at 11:25 PM, Stanley Li <[email protected]> wrote:
>
>> Hi all,
>>
>> I want to draw a text on top of a bitmap.
>>
>> So in my onDraw function, i do the following:
>>
>> canvas.drawBitmap(myBitmap, 30, 30, mPaint);
>> textPaint.setTextSize(20);
>> canvas.drawText("Life X 3", 30, 30, textPaint);
>>
>> However, it ended up that the text is above the bitmap. (the X position is
>> correct, but the y position is not).
>>
>> Can anyone help me with this?
>>
>> Thanks in advance,
>> Stanley
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]<android-developers%[email protected]>
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to