2014-08-28 95 views
1

我正在开发移动应用程序在钛合金下订单。 在我的应用程序中,我必须显示先前的订单历史记录一个用于写入订单的文本框和一个用于发送它的按钮。对于我做的休耕代码 XML文件得到不同的结果在仿钛和钛合金设备应用程序

<Alloy> 
    <Window class="container" id="win"> 
     <View id="TextOrders"> 
      <ScrollView id="scrollView" showVerticalScrollIndicator="true" showHorizontalScrollIndicator="true"> 

      </ScrollView> 
      <TextArea id="txtTextOrder"></TextArea> 
      <Button id="btnSend" onClick="SendTextOrder">Send</Button> 
     </View> 
    </Window> 
</Alloy> 

JS文件

var args = arguments[0] || {}; 
var win = Ti.UI.createWindow({ 
    backgroundColor:'white' 
}); 

var TextOrders = Ti.UI.createView({ 
    backgroundColor:'white' 
}); 
function createRow(Request_Id,Order,Date) { 
    var row = Ti.UI.createView({ 
    backgroundColor: 'white', 
    borderColor: '#F5FFC6', 
    borderWidth: 1, 
    width:'80%', 
    top: 10, 
    left: 5, 
    layout: 'vertical', 
    height:Ti.UI.SIZE, 
    shadow:{color:'#F5FFC6', offset:{width:3,height:3}}, 
    backgroundColor:'#F5FFC6', 
    borderRadius:'5', 
    viewShadowColor:'black', 
    viewShadowOffset:{ width:5,height:5}, 
    viewShadowRadius:'5', 
    opacity:'0.6' 
    }); 
var lblRequest_Id = Ti.UI.createLabel({ 
    text: "OrderId : "+Request_Id, 
    top: 10, 
    left: '5', 
    width: '80%', 
    color:'#000', 
    }); 
    var lblOrder = Ti.UI.createLabel({ 
    text: Order, 
    top: 10, 
    left: '5', 
    width: '80%', 
    color:'#000', 

    }); 
    var lblDate = Ti.UI.createLabel({ 
    text: Date, 
    top: 10, 
    left: '5', 
    width: '80%', 
    color:'#000', 
    }); 
    row.add(lblRequest_Id); 
    row.add(lblOrder); 
    row.add(lblDate); 
    return row; 
} 
var scrollView = Ti.UI.createScrollView({ 
    bottom:220, 
    contentHeight: 'auto', 
    layout: 'vertical', 
    top:'0px', 
    height:(Ti.Platform.displayCaps.platformHeight-220), 
    zIndex:10, 
    backgroundColor:'#F0F0F0', 
}); 

var db = Ti.Database.open('Database\AppDb');  
try{ 
    var OrderDetails = db.execute('SELECT * FROM Text_Orders'); 
    while (OrderDetails.isValidRow()) 
    { 
     var row = createRow(OrderDetails.fieldByName('Request_Id'),OrderDetails.fieldByName('Order'),OrderDetails.fieldByName('Date')); 
     scrollView.add(row); 
     scrollView.scrollToBottom(); 
     OrderDetails.next(); 
    } 
} 
catch(e){ 
} 
finally{ 
    db.close(); 
} 

scrollView.scrollToBottom(); 
$.TextOrders.add(scrollView); 
win.add(TextOrders); 

$.win.open(); 

在TSS文件

".container" : { 
    backgroundColor:"white", 
    backgroundImage:"/assets/Images/BackgroundImg.jpg", 
} 
"#TextOrders":{ 
    width:'100%', 
    height:'100%', 
    top:'0px', 
} 
"#scrollView":{ 
    borderColor:'blue', 
    borderWidth:'1px', 
    top:'0px', 
    height:'100%', 
    bottom:'120dp', 
} 

"#txtTextOrder":{ 
    width:'99%', 
    height:"100dp", 
    left:3, 
    borderWidth:'1px', 
    borderColor: '#bbb', 
    backgroundColor:'#FFF', 
    borderRadius: 5, 
    color: '#888', 
    bottom:'50dp', 
    hintText:'Write your order', 
    zIndex:11, 
} 
"#btnSend":{ 
    width: Ti.UI.SIZE, 
    height: Ti.UI.SIZE, 
    color: "#000", 
    width:'99%', 
    left:3, 
    bottom:'0dp', 
    zIndex:11, 
} 

我得到的结果在模拟器作为

enter image description here

但是当我在移动设备上安装它我得到的结果作为 enter image description here

我的魔杖为了视图应该从上面开始和结束的文本框在模拟器上面。我不明白为什么会显示不同的结果。

回答

0

,因为你设置的高度和底部了滚动两种属性,以便只是删除滚动视图的高度财产和尝试...

"#scrollView":{ 
    borderColor:'blue', 
    borderWidth:'1px', 
    top:'0px', 
    bottom:'120dp', 
}