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

时间:2017-08-25 09:21:34

标签: xamarin xamarin.forms

这是我的代码:

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

有很多标签,很多标签都会脱离屏幕的末尾。但屏幕不会滚动。如何使其可滚动?

2 个答案:

答案 0 :(得分:6)

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

答案 1 :(得分:1)

如果您只有标签并且它们非常简单,为什么不使用具有隐式滚动的ListView?否则Cole Xia是正确的,包装在ScrollView

相关问题