0
我正在開發一個使用Appcelerator的iOS應用程序。 在這個應用程序,我有一個主包裝視圖和一些子視圖。我需要使用佈局垂直屬性將它們置於彼此之下,但它們都堆疊在一堆(而不是單獨的「行」)中。如何使用垂直佈局?
下面的代碼有什麼問題?
// Create the padding view
container = Ti.UI.createView({
top: 0,
left: 0,
width: 320,
height: 460,
backgroundColor: '#000'
});
// Create the padding view
wrapper = Ti.UI.createView({
top: 0,
left: 0,
width: 320,
height: 'auto',
layout: 'vertical'
});
// Create the padding view
label = Ti.UI.createLabel({
text: e.label,
color: e.color,
font:{fontSize:36,fontWeight: 'normal'},
top: 10,
width: 'auto',
height: 'auto'
});
// Create the padding view
perks_label = Ti.UI.createLabel({
text: 'Lorem Ipsum is',
color: '#fff',
font:{fontSize:26,fontWeight: 'normal'},
top: 10,
left: 10,
width: 'auto',
height: 'auto'
});
// Create the padding view
perks_data = Ti.UI.createLabel({
text: 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer',
color: '#fff',
font:{fontSize:12,fontWeight: 'normal'},
top: 10,
left: 10,
width: 'auto',
height: 'auto'
});
// Add label to wrapper
wrapper.add(label);
// Add label to wrapper
wrapper.add(perks_label);
// Add label to wrapper
wrapper.add(perks_data);
// Add wrapper to container
container.add(wrapper);
// Return the row
return container;
我看不出任何代碼有問題,並且它在您的Android平臺上工作。您是否使用標籤的特定高度值進行了嘗試?如果Titanium無法計算出會影響自動定位的標籤有多高。 – Craig