如下面範例:
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是用來設定預設的按鈕圖案,
overFile是用來設定使用者按下按鈕時按鈕的顯示圖案,
按鈕上的文字是"botton 1", 可是它的大小和顏色是預設的,
如果想要改變,可以參考以下範例:
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, }
沒有留言:
張貼留言