Created
March 3, 2014 21:25
-
-
Save tylerchesley/9334946 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int xPos = (canvas.getWidth() / 2); | |
int yPos = (int) ((canvas.getHeight() / 2) - ((textPaint.descent() + textPaint.ascent()) / 2)) ; | |
//((textPaint.descent() + textPaint.ascent()) / 2) is the distance from the baseline to the center. | |
canvas.drawText("Hello", xPos, yPos, textPaint); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment