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

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

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
});

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744772824a4592863.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信