如何在newButton上设置TextColor?

时间:2014-03-27 22:14:12

标签: fonts colors lua corona

如何更改widget.newButton的字体颜色?

我尝试过的事情:

    playBtn = widget.newButton{
        left = display.contentCenterX,
        top = 0,
        id = "playbutton",
        label = "Play",
        emboss=true,
        width = 250,
        height = 70,
        fontSize = 30,
        defaultFile = "media/button-2.png",
        overFile = "media/button-2.png",
        onEvent = playBtnF
    }

playBtn:setTextColor( 0, 255, 255 )

1 个答案:

答案 0 :(得分:4)

您好,如果它是标签的颜色我相信您可以在选项中使用labelColor来设置标签的颜色,请参阅corona widget.newButton()中的更多内容。

示例:

playBtn = widget.newButton{
        left = display.contentCenterX,
        top = 0,
        id = "playbutton",
        label = "Play",
        labelColor = { default={ 1, 1, 1 }, over={ 0, 0, 0, 0.5 } }, // This is the option
        emboss=true,
        width = 250,
        height = 70,
        fontSize = 30,
        defaultFile = "media/button-2.png",
        overFile = "media/button-2.png",
        onEvent = playBtnF
    }

如果您不使用电晕API库,请指定您正在使用的库。希望这会有所帮助。