打开你的titanuim studio
app.js
//window -> view -> laber
//create window
var win = Ti.UI.createWindow({
backgroundColor : 'yellow'
});
//create view
var view =Ti.UI.createView();
//create laber
var laber = Ti.UI.createLabel({
text : 'Hello World',
height : 35,
width : 150,
top : 150,
color : 'red'
});
//create button
var button = Ti.UI.createButton({
title : '确定',
width : 100,
top: 200
});
button.addEventListener('click',function(e){
alert('you clicked me!');
//在控制栏中显示信息
Ti.API.info('输出信息:。。。。。');
});
view.add(button);
// add laber
view.add(laber);
//add view
win.add(view);
//open window
win.open();
//输出信息
Ti.API.info("width:" +Ti.Platform.displayCaps.platformWidth);
Ti.API.info('height' +Ti.Platform.displayCaps.platformHeight);
点击确定
详细操作请看上一篇