如何在newButton上设置TextColor?

Orl*_*rlo 0 fonts lua colors coronasdk

如何更改字体颜色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 )
Run Code Online (Sandbox Code Playgroud)

Sam*_*pez 5

您好,如果它是标签的颜色,我相信您可以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
    }
Run Code Online (Sandbox Code Playgroud)

如果您不使用电晕 API 库,请指定您使用的库。希望这可以帮助。