Text 如何在Lua中对文本进行右对齐?

Text 如何在Lua中对文本进行右对齐?,text,sdk,lua,alignment,coronasdk,Text,Sdk,Lua,Alignment,Coronasdk,我已经尝试了几个例子来说明如何在Lua中正确地证明文本。到目前为止,我一直没有成功。我正在使用Corona Sdk。任何建议都将不胜感激。 杰瑞也许这会奏效: local textObj = display.newText(.....); textObj:setReferencePoint(display.CenterRightReferencePoint); textObj.x = 100; 在具有graphics 2.0的Corona SDK的新版本中,您需要执行以下操作: rowScor

我已经尝试了几个例子来说明如何在Lua中正确地证明文本。到目前为止,我一直没有成功。我正在使用Corona Sdk。任何建议都将不胜感激。
杰瑞

也许这会奏效:

local textObj = display.newText(.....);
textObj:setReferencePoint(display.CenterRightReferencePoint);
textObj.x = 100;

在具有graphics 2.0的Corona SDK的新版本中,您需要执行以下操作:

rowScore.anchorX = 1
其中rowScore是使用display.newText创建的变量。 下面是一个完整的示例:

local rowScore = display.newText({
    text="My Score", 
    fontSize=40 
})
rowScore.anchorX = 1
rowScore.x = 30
rowScore.y = 100
注意,我没有使用align=right参数,因为它在Windows模拟器上工作,但在Android上不工作