Xamarin 如何使用两帧的绝对布局?
我使用绝对布局,我想添加两个网格。第一帧占3/1,第二帧占屏幕剩余空间。那怎么做呢? 我正在使用:Xamarin 如何使用两帧的绝对布局?,xamarin,xamarin.forms,Xamarin,Xamarin.forms,我使用绝对布局,我想添加两个网格。第一帧占3/1,第二帧占屏幕剩余空间。那怎么做呢? 我正在使用: <ContentPage.Content> <AbsoluteLayout BackgroundColor="White" x:Name="Parent"> <Grid BackgroundColor="Red" AbsoluteLayout.LayoutFlags="PositionProportional,WidthPro
<ContentPage.Content>
<AbsoluteLayout BackgroundColor="White" x:Name="Parent">
<Grid BackgroundColor="Red" AbsoluteLayout.LayoutFlags="PositionProportional,WidthProportional"
AbsoluteLayout.LayoutBounds="0,0,1,180"/>
<Grid x:Name="KeypadGrid" BackgroundColor="Orange">
</Grid>
</AbsoluteLayout>
</ContentPage.Content>
您可以使用网格执行此操作。装置的每个高度方向计算为10*。在这里,我指定3*为顶部,7*为底部。它将兼容所有设备
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="3*"/> // top
<RowDefinition Height="7*"/> // bottom
</Grid.RowDefinitions>
<Grid/>
//顶
//底部
并添加您想要的内容
<Grid Grid.Row="0">
// view here for top red space
<Grid/>
<Grid Grid.Row="1">
// view here for orange
<Grid/>
//在此处查看顶部红色空间
//在这里观看橙色
使用绝对布局比例值:
<AbsoluteLayout>
<Frame AbsoluteLayout.LayoutBounds="0,0,1,.33" AbsoluteLayout.LayoutFlags="All" BackgroundColor="Red" >
~~~
</Frame>
<Frame AbsoluteLayout.LayoutBounds="1,1,1,.67" AbsoluteLayout.LayoutFlags="All" BackgroundColor="Green" >
~~~
</Frame>
</AbsoluteLayout>
re:我已经这样做了,但是我需要使用一些绝对位置,这和使用绝对布局一样重要。