Corona SDK: Center text horizontally

How to center text horizontally with Corona SDK:

local aboutText = display.newText("", 0, 0, native.systemFontBold, 13)
aboutText:setReferencePoint(display.CenterReferencePoint)
aboutText.x = display.contentWidth * 0.5
aboutText.y = display.contentHeight * 0.5 - 30<
aboutText:setTextColor(255, 255, 255)
aboutText.text = "Horizontal centered!"

About Dominik
Currently working as an Android/iOS developer for Cineman, Switzerland. Owner of http://www.ukon.ch and https://play.google.com/store/apps/details?id=com.cheatdatabase

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

You must be logged in to post a comment.