最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Appcelerator Titanium: Controlling Views Height and Top Automatically - Stack Overflow

programmeradmin1浏览0评论
var Section1 = Titanium.UI.createView({
    top:0,
    height: 'auto',
});


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

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

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


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

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

Share Improve this question asked Apr 14, 2011 at 15:06 theJavatheJava 15k48 gold badges134 silver badges174 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 4

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)

  1. 暂无评论