【发布时间】:2021-08-02 11:52:11
【问题描述】:
现在滚动视图工作正常,在某些情况下,我曾经定义如下,我可以将绝对布局的内容与滚动视图一起使用,也可以直接使用。
在sn-p下面直接使用时,通过设置layout bounds平移后,所有box view都排列在指定的高度。
但以前它会在翻译后在底部裁剪。当不使用滚动视图时,我需要相同的行为。如何做到这一点。
<AbsoluteLayout x:Name="layout" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Grid.Row="1">
<Grid x:Name="scrollView" AbsoluteLayout.LayoutFlags="SizeProportional" AbsoluteLayout.LayoutBounds="0,0,1,1" >
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<BoxView Grid.Row="0" BackgroundColor="Red"></BoxView>
<BoxView Grid.Row="1" BackgroundColor="Black"></BoxView>
<BoxView Grid.Row="2" BackgroundColor="Blue"></BoxView>
<BoxView Grid.Row="3" BackgroundColor="Gray"></BoxView>
<BoxView Grid.Row="4" BackgroundColor="Green"></BoxView>
<BoxView Grid.Row="5" BackgroundColor="Red"></BoxView>
<BoxView Grid.Row="6" BackgroundColor="Black"></BoxView>
<BoxView Grid.Row="7" BackgroundColor="Blue"></BoxView>
<BoxView Grid.Row="8" BackgroundColor="Gray"></BoxView>
<BoxView Grid.Row="9" BackgroundColor="Green"></BoxView>
</Grid>
在这种情况下,当我设置布局边界时,它会像第二张图片一样排列,但我需要像第一张图片一样。
【问题讨论】:
标签: xamarin.forms scrollview absolutelayout