admin管理员组

文章数量:1392007

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

本文标签: javascriptAppcelerator Titanium Controlling Views Height and Top AutomaticallyStack Overflow