【发布时间】:2016-08-13 15:43:14
【问题描述】:
我正在尝试将StackLayout 水平居中在ScrollView 内。但是,StackLayout 不是水平居中的(它是左对齐的)。我尝试将 ScrollView 居中,但整个视图不可滚动 - 只有中心部分是。
<ScrollView BackgroundColor="Teal">
<StackLayout Spacing="5"
Padding="30"
WidthRequest="400"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand"
BackgroundColor="Transparent">
<Label Text="Test"/>
<Label Text="Test"/>
<Label Text="Test"/>
<Label Text="Test"/>
</StackLayout>
</ScrollView>
居中适用于 2 个嵌套的 StackLayout 元素,但不适用于 ScrollView。有什么想法吗?
【问题讨论】:
-
你可以在scrollview里面有两个stacklayout
标签: xaml layout xamarin xamarin.forms