Xaml Xamarin形成绝对布局重叠

时间:2017-07-20 14:10:53

标签: forms xaml xamarin xamarin.forms

AbsoluteLayoutTemplate

鉴于上述图片,我将如何设置我的Absolute Layouts? 我想让我的蓝色绝对布局重叠红色边框绝对布局。我知道有一个doc解释了AbsoluteLayouts是如何工作的,但我仍然不完全理解它。

我尝试过以下方式设置布局,但蓝色方块始终隐藏。

使用下面的代码我根本不会看到蓝色布局。

<AbsoluteLayout>
 <AbsoluteLayout x:Name="BlueSquare">
    <StackLayout> (Asumme there is a list of things in here) </StackLayout>
 </AbsoluteLayout>
 <AbsoluteLayout x:Name="RedBorderArea">
    <StackLayout> (Asumme there is another list of stuff in here) </StackLayout>
 </AbsoluteLayout>
</AbsoluteLayout>

1 个答案:

答案 0 :(得分:0)

在修补后我需要添加蓝色方块布局,然后我删除了RedSquares父布局。

<AbsoluteLayout>
    <StackLayout x:Name="RedBorderArea" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0.5,0.5,1,1"> (Asumme there is another list of stuff in here) </StackLayout>
    <AbsoluteLayout x:Name="BlueSquare" LayoutFlags="PositionProportional, WidthProportional" LayoutBounds="1,0,1,1">
       <StackLayout> (Asumme there is a list of things in here) </StackLayout>
    </AbsoluteLayout>
</AbsoluteLayout>