您的位置:首页 > 其它

titanium开发教程-02-02创建按钮

2012-03-16 22:13 447 查看




 

var win = Titanium.UI.createWindow({
title:"创建按钮",
backgroundColor:"#FFFFFF",
exitOnClose:true
});

var simpleButton = Titanium.UI.createButton({
title:"按住我",
width:"25%",
height:"10%",
top:"10%",
id:"Simple Button",
})

var customButton = Titanium.UI.createButton({
title:"按住我",
backgroundImage:"images/button.png",
backgroundSelectedImage:"images/button-over.png",
width:"25%",
height:"10%",
bottom:"10%",
id:"Custom Button"
});

simpleButton.addEventListener("click", function(e){
//e 是 事件本身
alert(e.source.id + " fired a " + e.type + " event");
});

customButton.addEventListener("touchend", function(e){

alert(e.source.id + " fired a " + e.type + " event");
});

win.add(simpleButton);
win.add(customButton);

win.open();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: