开发者

Appcelerator Titanium: Controlling Views Height and Top Automatically

var Section1 = Titanium.UI.createView({
    top:0,
    height: 'auto',
});


var Section2 = Titanium.UI.createView开发者_StackOverflow中文版({
    top:0,
    height: 'auto',
});

I have two views and these two views has some buttons and TextFields which comes dyanmically. How can i control the Section 2 that it does not over lap the Section 1 View when its height gets increased.


I don't know if there's a better way, but I had a similar issue recently, which I tentatively solved like so

var Section1 = Titanium.UI.createView({
    top:0,
    height: 'auto',
});

// Add other views to Section1

var Section2 = Titanium.UI.createView({
    top: Section1.toImage().height,
    height: 'auto',
});

I think in your case the height will only be accurate after you've added your other views and objects to it.


If you are adding your views directly to the Ti.UI.currentWindow then you can just set layout of the Ti.UI.currentWindow to 'vertical' and the heights will automatically adjust

Ti.UI.currentWindow.layout = 'vertical';


Ti.UI.createView({ 
            layout : 'vertical',
            height : Ti.UI.SIZE
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜