Code Block : //Define the current window var currentWin = Ti.UI.currentWindow; //Define a label var messageLbl = Ti.UI.createLabel({ width : '100dp', //assign the width with dp values height : '20dp', //assign the height with dp values top : '20dp', //assign the top position with dp values left : '10dp', // assign the left position with dp values text : 'Hi! this is a label control' }); //Label added to the window currentWin.add(messageLbl); //Define a button var sampleButton = Ti.UI.createButton({ width : '50%', //assign the width with % values height : '10%', //assign the height with % values bottom : '20%', //assign the bottom position with % values right : '10%', // assign the right position with % values title : 'Hi! this is a button control' }); //Button added to the window currentWin.add(sampleButton);
I have tested it with different resolutions of Android devices.