Simple
Create a new file called frames.js
var per100 = Math.floor(Titanium.Platform.displayCaps.platformWidth * 1.0);
var per90 = Math.floor(Titanium.Platform.displayCaps.platformWidth * 0.9);
var per80 = Math.floor(Titanium.Platform.displayCaps.platformWidth * 0.8);
var per50 = Math.floor(Titanium.Platform.displayCaps.platformWidth * 0.5);
var per40 = Math.floor(Titanium.Platform.displayCaps.platformWidth * 0.4);
var per25 = Math.floor(Titanium.Platform.displayCaps.platformWidth * 0.25);
var per10 = Math.floor(Titanium.Platform.displayCaps.platformWidth * 0.10);
var per5 = Math.floor(Titanium.Platform.displayCaps.platformWidth * 0.05);
var per1 = Math.floor(Titanium.Platform.displayCaps.platformWidth * 0.01);
Now include frames.js in js files.
You can use it as such, it will be a liquid button, 90%
var btngeorgia=Titanium.UI.createButton({
color:'#d8d8d8',
borderRadius:'2px',
height:30,
width:per90,
zIndex:800,
left:10,
bottom:100,
title:'Georgia',
font:'Georgia',
});
This will be a 100% web view of the deviceโs fluid width.
WebViewWindow=Titanium.UI.createWebView({
html:globalHTMLHeadert,
visible:true,
width:per100,
left:0,
bottom:220,
zIndex:300
});
source
share