local widget = require( "widget" ) local button1Press = function( event ) print("button1 pressed") end local button1 = widget.newButton { defaultFile = "buttonYellow.png", overFile = "buttonYellowOver.png", label = "botton 1", onPress = button1Press, }defaultFile is to set the default picture,
overFile is to get the picture when use press this button.
The text on button is "botton 1".
However, its size and color are as default.
If we want to change them, we can reference the following codes:
local widget = require( "widget" ) local button1Press = function( event ) print("button1 pressed") end local button1 = widget.newButton { defaultFile = "buttonYellow.png", overFile = "buttonYellowOver.png", label = "botton 1", font = native.systemFont, fontSize = 20, emboss = true, labelColor = { default = { 0.5, 1, 1 }, over = { 0.5, 0.5, 0.5} }, onPress = button1Press, }
沒有留言:
張貼留言