簡體   English   中英

查看容器破壞了我的代碼

[英]View container breaks my code

我正在嘗試為鈦合金應用實現布局。 到目前為止,這是我的代碼:

<Alloy>

 <Window class="container">` <View id="containerView" class="container" layout="vertical"> <View id="navBarView" layout='horizontal'> <Button id="id" onClick="doClick" title="title" width="50%"height="50dp"/> <Button id="id1" onClick="doClick" title="title" width="50%" height="50"/> </View> <!-- Here are several labels which should be grouped vertically --> </View> </Window> </Alloy> 

(對不起,格式錯誤)

如果我刪除containerView,則顯示標簽,但垂直居中。 我希望它們在navBarView之后直接顯示。 當我按原樣運行代碼時,它根本不會顯示任何標簽。 我的navBarView一直都處於例外狀態。

我感謝您的每一次投入,我是鈦的新手。

只需將width & heigth & top作為示例,放在您的tss文件中:

"#navBarView":{
       height:'20%',
       top:0,
       width:'100%'
 }
".yourlabelContainer":{
     height:'80%',
     layout:'vertical',
     width:'100%'
}
".mylabel":{
     font:{
        fontSize:19,
        fontWeight:'bold'
     },
     color:'#000'
     height:'20%' //(100/5)
}

並在xml文件中:

<Alloy>
   <Window class="container">`
      <View id="containerView" class="container" layout="vertical">
        <View id="navBarView" layout='horizontal'>
          <Button id="id" onClick="doClick" title="title" width="50%"height="50dp"/>
          <Button id="id1" onClick="doClick" title="title" width="50%" height="50"/>
        </View>
        <View calss="yourlabelContainer">
           <Label class="mylabel>Lab1</Label>
           <Label class="mylabel>Lab2</Label>
           <Label class="mylabel>Lab3</Label>
           <Label class="mylabel>Lab4</Label>
           <Label class="mylabel>Lab5</Label>
        </View>   
       </View>
    </Window> 
</Alloy>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM