2016-06-28 26 views
0

我建立一個應用程序與鈦我如何可以插入垂直滾動條在鈦

現在我想設置在一個窗口中滾動型,因爲這個窗口的內容是大的設備。所以我想插入一個ScrollView並顯示垂直滾動條。

所以我建立這個代碼:

<Alloy> 
    <Window id="indexWindow" orientation="Titanium.UI.UPSIDE_PORTRAIT" fullscreen="false"> 
     <ScrollView id="scrollView" showVerticalScrollIndicator="true" 
      showPagingControl= "true" showHorizontalScrollIndicator="true" height="80%" width="80%"> 

     <View class="container" layout="vertical"> 
      <!-- title --> 
      <Label id="titleDatiAnagrafici" class="labelTitle" ></Label> 

      <!-- personal data --> 
      <TableView id="form_table" height="Titanium.UI.SIZE"> 

       <TableViewRow id="name_row" class="row_item" layout="horizontal"> 
        <Label id="name_label" class="label" /> 
        <Label text="Mario" class="labelData"/> 

        <Label id="surname_label" class="label" left="20px"/> 
        <Label text="Rossi" class="labelData"/> 
       </TableViewRow> 

       <TableViewRow id="name_row" class="row_item" layout="horizontal"> 
        <Label id="address_label" class="label" /> 
        <Label text="via Cereate 8, Milano" class="labelData"/> 

       </TableViewRow> 

       <TableViewRow id="name_row" class="row_item" layout="horizontal"> 
        <Label id="phone_label" class="label"/> 
        <Label text="333111222" class="labelData"/> 
       </TableViewRow> 

      </TableView> 



     </View> 
     </ScrollView> 
    </Window> 
</Alloy> 

,但我看不到垂直滾動條。

+0

請檢查你的代碼中沒有標籤只我猜你抄錯 – Nestoraj

+0

是的,我錯了複製的代碼,所以我有編輯自己的帖子現在 – bircastri

+0

你能看到的看法?或者你只是看不到滾動條 – Nestoraj

回答

1

您必須使用視圖的高度屬性。

<Window id="indexWindow" orientation="Titanium.UI.UPSIDE_PORTRAIT" fullscreen="false"> 
    <ScrollView id="scrollView" showVerticalScrollIndicator="true" 
     showPagingControl= "true" showHorizontalScrollIndicator="true" height="80%" width="80%"> 

    <View class="container" layout="vertical" height="2000"> 
     <!-- title --> 
     <Label id="titleDatiAnagrafici" class="labelTitle" ></Label> 

     <!-- personal data --> 
     <TableView id="form_table" height="Titanium.UI.SIZE"> 

      <TableViewRow id="name_row" class="row_item" layout="horizontal"> 
       <Label id="name_label" class="label" /> 
       <Label text="Mario" class="labelData"/> 

       <Label id="surname_label" class="label" left="20px"/> 
       <Label text="Rossi" class="labelData"/> 
      </TableViewRow> 

      <TableViewRow id="name_row" class="row_item" layout="horizontal"> 
       <Label id="address_label" class="label" /> 
       <Label text="via Cereate 8, Milano" class="labelData"/> 

      </TableViewRow> 

      <TableViewRow id="name_row" class="row_item" layout="horizontal"> 
       <Label id="phone_label" class="label"/> 
       <Label text="333111222" class="labelData"/> 
      </TableViewRow> 

     </TableView> 



    </View> 
    </ScrollView> 
</Window> 

默認情況下,視圖取其父級的大小,所以滾動視圖永遠不會出現。

0

與文件根據,您可以在滾動型標記添加以下屬性:

showVerticalScrollIndicator="true" 

您可以用同樣的方法添加,如果你還想要一個單槓:

showHorizontalScrollIndicator: true 

看在文檔here

問候

+0

對不起,我有錯誤的代碼,我剛剛編輯我的代碼 – bircastri