2013-12-17 37 views
0

我使用VerticalLayout的和裏面有很多組件,所以顯示不顯示所有的項目:如何在移動flex中使用VerticalLayout進行滾動?

<s:layout> 
     <s:VerticalLayout horizontalAlign="center" verticalAlign="middle" paddingLeft="5" paddingRight="5" paddingTop="5" paddingBottom="5" /> 
    </s:layout> 
    <s:TextInput id="chp1" width="50%"/> 
    <s:TextInput id="chp2" width="50%"/> 
    <s:Button label="Enregistrer" click="enregistrer(event)" styleName="btn"/> 
    <s:Button label="Lire" click="lire(event)" styleName="btn" /> 
    <s:TextArea id="area"/> 
    <s:HGroup> 
     <s:Button label="Envoyer" click="send(event)" styleName="btn" /> 
     <s:Button label="Retour" click="navigator.popView()" styleName="btn" /> 
    </s:HGroup> 
    <s:TextArea id="resultHTTP"/> 
     ... 

如何啓用垂直滾動在這種情況下?

回答

1

我似乎從來沒有得到它的工作,除非我用這個神奇的食譜:

<!-- Use size rules to set the upper limit in the bounding box with clipAndEnableScrolling --> 
<s:Group width="100%" height="100%" clipAndEnableScrolling="true"> 
    <!-- Pin the scroller to the absolute bounds --> 
    <s:Scroller top="0" left="0" bottom="0" right="0"> 
     <!-- The direction (vertical/horizontal) you want to scroll should         
      not have an explicit bounds--> 
     <s:Group width="100%"> 
      <s:layout> 
       <s:VerticalLayout horizontalAlign="center" paddingBottom="5" paddingLeft="5" paddingRight="5" 
            paddingTop="5" verticalAlign="middle" /> 
      </s:layout> 
      <!-- Scrollable content goes here --> 
     </s:Group> 
    </s:Scroller> 
</s:Group> 

滾動條會出現一旦內容變得很大的可見區域

+0

爲什麼你需要滾動條時,內容可以看到第一個可見區域? –

+0

我不認爲我理解你的問題。根據內容和屏幕大小,內容可能不可見。在這種情況下,您希望它滾動而不是剪輯內容或從容器中「泄漏」。 – drkstr1

1

您必須使用Scroller並將要滾動的視口換成一個。

1

這裏是如何添加垂直滾動一個基本演示:

<s:Scroller height="100" width="100" verticalScrollPolicy="auto"> 
      <s:Group height="100%" width="100%"> 
       <mx:VBox height="100%" width="100%"> 
        <mx:Button label="abcd"/> 
        <mx:Button label="abcd"/> 
        <mx:Button label="abcd"/> 
        <mx:Button label="abcd"/> 
        <mx:Button label="abcd"/> 
        <mx:Button label="abcd"/> 
        <mx:Button label="abcd"/> 
        <mx:Button label="abcd"/> 
        <mx:Button label="abcd"/> 
       </mx:VBox> 
      </s:Group> 
     </s:Scroller> 
相關問題