我的合金项目中有一个滚动视图,当按下按钮时我需要添加一些视图,但是内容高度、可滚动区域并没有改变,底部内容远离视图。这是我的合金视图 (.xml) 文件
<Alloy>
<Window class="container">
<ScrollView id="MainView" >
<View id="innerContent" class="rowLayout">
<Label>Address 1</Label>
<TextField id="Address1" class="textArea"></TextField>
</View>
</ScrollView>
<View id="buttonView">
<Button id="button" onClick="doClick" title="Add New Address Input" top="10" width="100" height="50" />
</View>
</Window>
</Alloy>
我的样式文件 (.tss),包含所有样式:
".container": {
backgroundColor:"white",
height: Titanium.UI.FILL
}
"#MainView": {
width: Titanium.UI.FILL,
height: Titanium.UI.FILL,
scrollType: "vertical",
layout: "vertical",
bottom: "100dp",
top: "20dp",
borderColor: "#008000",
borderWidth: "1px",
left:"2dp",
right: "2dp"
}
"#buttonView" : {
height: "50dp",
width: Titanium.UI.FILL,
right: "10dp",
left: "10dp",
bottom: '8dp',
borderColor: "#000000",
borderWidth: "1px"
}
".rowLayout": {
layout: "vertical"
}
".textArea" : {
height: "70dp",
width: Titanium.UI.FILL,
borderColor: "#000000",
borderWidth: "1dp",
left: "8dp",
right: "8dp"
}
还有我的控制器(.js)
var counter=0;
function doClick() {
counter++;
var label = Ti.UI.createLabel({
text: "Address " + counter + " :"
});
var textField = Ti.UI.createTextField({
height: "70dp",
width: Titanium.UI.FILL,
borderColor: "#000000",
borderWidth: "1dp",
top: "5dp",
right: "8dp",
left: "8dp"
});
$.innerContent.add(label);
$.innerContent.add(textField);
}
$.index.open();