I have a custom View which is supposed to draw some text bottom aligned. Size of text should be 50% of view height.
How should I change this code to work correctly?
@Override
protected void onDraw(Canvas canvas)
{
float h = getMeasuredHeight();
float textHeight = h*0.5f;
paint.setTextSize(textHeight);
String str = "Abcdefghijklm";
paint.getTextBounds(str, 0, str.length(), bounds);
float height = bounds.height();
float yPos = height;
canvas.drawText(str, 0, yPos, paint);
}