我正在使用最新的 xamarin 表单。
我有一个要求,我需要在网格中的两行之间放置一个框架。
我无法使其与绝对布局或弹性布局一起使用。下面是我对网格的简化尝试
<Grid ColumnSpacing="1" RowSpacing="1">
<Grid.RowDefinitions>
<RowDefinition Height="5*"/>
<RowDefinition Height="8*"/>
</Grid.RowDefinitions>
<Grid BackgroundColor="Red" Grid.Row="0">
<Label Text="Add some stuff here"></Label>
</Grid>
<Grid BackgroundColor="Blue" Grid.Row="1">
<Frame BackgroundColor="Green" HeightRequest="100" WidthRequest="100" Margin="20,-150,20,20"></Frame>
</Grid>
</Grid>
这是我不想要的结果
我似乎无法设置框架的高度请求,因为它仍然很大。
在两行之间覆盖框架的最佳方法是什么?
thanks
对于您的布局,您可以按以下方式使用 AbsoluteLayout:
<AbsoluteLayout BackgroundColor="Blue" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" >
<StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" BackgroundColor="Pink" AbsoluteLayout.LayoutBounds="1,0,1,0.5" AbsoluteLayout.LayoutFlags="All" />
<StackLayout AbsoluteLayout.LayoutBounds="1,1,1,0.5" AbsoluteLayout.LayoutFlags="All" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" BackgroundColor="Beige"/>
<Frame AbsoluteLayout.LayoutBounds="0.5,0.5,0.8,0.5" AbsoluteLayout.LayoutFlags="All" BackgroundColor="White" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" CornerRadius="20" />
</AbsoluteLayout>
You will get the following design from the above implementation.
![](https://i.stack.imgur.com/FAwWK.png)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)