简体   繁体   English

如何在Stackable中使用StackLayout创建一个ContentPage?

[英]How can I make a ContentPage with a StackLayout inside scrollable?

Here is the code I have: 这是我的代码:

<ContentPage>
   <ContentPage.Content>
       <StackLayout Spacing="10" Margin="20">
       <Label /> 
       <Label />
       <Label />
       .....
       <Label />
       <Label />
       </StackLayout>
   </ContentPage.Content>
</ContentPage>

There are a large number of labels, so many that they go off the end of the screen. 有很多标签,很多标签都会脱离屏幕的最后。 But the screen won't scroll. 但屏幕不会滚动。 How can I make it scrollable? 如何使其可滚动?

<ContentPage.Content>
    <ScrollView>
        <StackLayout>
            <Label /> 
            <Label /> 
            <Label /> 
            <Entry />
        </StackLayout>
    </ScrollView>
</ContentPage.Content>

If you only have Labels and they are pretty simple, why not use a ListView which has implicit scrolling? 如果你只有标签并且它们非常简单,为什么不使用具有隐式滚动的ListView? Otherwise Cole Xia is correct, wrap in a ScrollView 否则Cole Xia是正确的,包装在ScrollView中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何删除 StackLayout 中的视图? - How can i remove views inside of StackLayout? 我需要包围一个 <TableView> 与一个 <StackLayout> 在一个 <ContentPage> - Do I need to surround a <TableView> with a <StackLayout> in a <ContentPage> 我可以在 TabbedPage 内的 ContentPage 中放置另一个 ContentPage 吗? - Can I put another ContentPage in ContentPage inside TabbedPage? 如何在contentpage的contentview的堆栈布局中添加控件? - How to add control in stacklayout of contentview in contentpage? 如何在Xamarin表单中的Scrollview内向Stacklayout添加HTML? - How can I add HTML to a Stacklayout inside a Scrollview in Xamarin forms? 如何在具有StackLayout内的网格的TableSection中模拟ViewCell? - How can I simulate a ViewCell in a TableSection with a Grid inside a StackLayout? 如何在 ContentPage 中显示 ContentView - How can I display a ContentView in a ContentPage 如何使堆叠布局中的按钮可单击,但使其余项目和堆叠布局不可单击? - How to make button inside a stacklayout clickable but make the rest of the items and the stacklayout not clickable? 如何基于具有StackLayout的Frame创建一个新的Xamarin元素? - How can I create a new Xamarin Element based on a Frame with a StackLayout inside of it? 如何在 StackLayout 中水平居中 FlexLayout? - How do I horizontally center a FlexLayout inside a StackLayout?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM