First post, go easy on me. :P

I searched around and haven't found anyone else even remotely talking
about this problem:

I have three virtual devices running: HDPI (854x480, Density: 240)
MDPI (480x320, Density: 160) and LDPI (432x240, Density: 120)

I'm drawing text with the following paint:

Paint paint = new EnginePaint(Paint.ANTI_ALIAS_FLAG);
paint.setColor(Color.WHITE);
paint.setTextSize(24.0f *
getResources().getDisplayMetrics().scaledDensity);

Screenshot: http://go.calebgray.com/km

As you can see the vertical spacing for MDPI is incorrect, the words
"dialog" and "look to" should be at the same y coordinate. (Look at
the number "2" above the "yes" button, it's in the same position on
HDPI and LDPI, but not for MDPI).

I've also attempted to use 24.0f *
(getResources().getDisplayMetrics().heightPixels / 320.0f) but the
result is the same.

In case it's not the text size and it's actually how I'm measuring the
text height, here is my multiline spacing code:

    for (int i = 0; i < _lines.length; i++) {
      canvas.drawText(_lines[i], drawX, drawY -
paint.getFontMetricsInt().top + (i *
Math.abs(paint.getFontMetricsInt().bottom -
paint.getFontMetricsInt().top)), paint);
    }

Thanks for your help! :D

- Caleb

-- 
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

Reply via email to