Android Canvas: put Text in the middle of the screen

Published by ugu5ma on

Code:

paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setTextAlign(Paint.Align.CENTER);
canvas.drawText("Hello Text", getMeasuredWidth()/2, getMeasuredHeight()/2, paint);

Categories: Androidjava

0 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.